utime.h(0P)

🫢 utime.h β€” access and modification times structure πŸ’–

okay bestie, so this one is from the POSIX Programmer's Manual β€” it's utime.h(0P), the header that's all about when stuff got touched. sit down, hydrate, let's go ✨


🌸 PROLOG 🌸

so like, real talk before we even start: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β€” so pls consult the corresponding Linux manual page for details of Linux behavior. also it's fully possible the interface isn't implemented on Linux at all. πŸ™ˆ vibe check your platform first, fr fr.


✨ NAME ✨

utime.h β€” the header for the access and modification times structure πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <utime.h>

that's it. that's the whole entrance. iconic behavior honestly πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the <utime.h> header shall declare the utimbuf structure, and that struct shall include these members:

time_t    actime    Access time.
time_t    modtime   Modification time.

the times are measured in seconds since the Epoch. yes, just seconds. we'll get to why that's lowkey a problem in a sec 😭

the <utime.h> header shall define the time_t type as described in <sys/types.h>.

and then β€” the following shall be declared as a function, and may also be defined as a macro. a function prototype shall be provided:

int utime(const char *, const struct utimbuf *);

also, for the record: the following sections are informative. (that's the manpage telling you the juicy part is over and the extra lore is next πŸ’œ)


πŸ’œ APPLICATION USAGE πŸ’œ

so here's the tea: the utime() function only allows setting file timestamps to the nearest second. that's it, that's the resolution, that's the whole camera πŸ“Έ

applications should use the utimensat() function instead. See <sys/stat.h>.

not me begging you to use the better one. bestie. please. the nanosecond girlies are waiting 🧚

🌈 RATIONALE 🌈

None.

(the standards committee said "no thoughts, head empty" and honestly? respect 🫑)


⭐ FUTURE DIRECTIONS ⭐

the <utime.h> header may be removed in a future version.

so like… it's giving deprecated-by-implication. don't build your whole personality on it πŸ’€

🌸 SEE ALSO 🌸

  • <sys_stat.h>
  • <sys_types.h>
  • The System Interfaces volume of POSIX.1‐2017, futimens(), utime()

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie!! this one's brought to you by IEEE/The Open Group, 2017, filed under utime.h(0P) β€” stay hydrated, use utimensat(), and go touch some files (timestamps, obviously) πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from