-
Notifications
You must be signed in to change notification settings - Fork 5
Description
This is nice for casual use, but spotted another problem: because of the float conversion, it loses nanosecond precision..
When I was trying to sketch out the tool, openrouter:z-ai/glm-4.5-air:free had suggested code like this for string conversion:
dt = datetime.datetime.utcfromtimestamp(sec)
birth_str = dt.strftime("%Y-%m-%d %H:%M:%S") + ".{:09d}".format(nsec)
Wanted to use this package to store creation time of newly created files in an xattr (with incron) and while this one is much easier to use, https://github.com/cmtgdv-org/python3-applib-statx is another implementation that circumvents the issue by returning a numpy.datetime64.. at the cost of extra syntax pain:
btime = statx.StatxResult(filepath, statx._statxc._statxc(pathname=filepath,
mask=statx._arg_mask.StatxMask.STATX_BTIME.value)).timestamp.creation
🤔 Any ideas of how to handle this sanely? Maybe adding a raw flag to the *time functions that defaults to False and can be used to get the tv_sec, tv_nsec tuple?
Originally posted by @eMPee584 in #7 (comment)