You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the tv_nsec field of a timespec structure has the special value UTIME_NOW, the file's relevant timestamp shall be set to the greatest value supported by the file system that is not greater than the current time. If the tv_nsec field has the special value UTIME_OMIT, the file's relevant timestamp shall not be changed. In either case, the tv_sec field shall be ignored.
Say I wanna update atime and leave mtime unchanged, if using utimes(2), I have to retrieve the previous mtime using stat(2) or something similar, but using utimensat(3) or futimens(3), I can just easily set the tv_nsec field of that timestamp to UTIME_OMIT.
So I think this feature deserves to be documented.
The text was updated successfully, but these errors were encountered:
SteveLauC
changed the title
Improve the doc for utimenstat(3) and futimens(3)
Improve the doc for utimensat(3) and futimens(3)Oct 5, 2022
Option 1 is a more natural way. But to avoid making existing user programs broken, what about adopting option 2 in the interim, leaving a TODO in it, and changing to option 1 when we can introduce breaking APIs
One advantage of
utimensat(3)
andfutimens(3)
overutimes(2)
is that they can just set one timestamp at a time.Cite the man page:
Say I wanna update
atime
and leavemtime
unchanged, if usingutimes(2)
, I have to retrieve the previousmtime
usingstat(2)
or something similar, but usingutimensat(3)
orfutimens(3)
, I can just easily set thetv_nsec
field of that timestamp toUTIME_OMIT
.So I think this feature deserves to be documented.
The text was updated successfully, but these errors were encountered: