utime() vs. utimes()

Because the utimes() function is no longer supported, you should use the POSIX.1 utime() function instead of utimes().

The arguments and semantics are slightly different. The syntax for the utimes() function is as follows:

int utimes(const char * path, const struct timeval * times);

The utime() function has the second argument times, which is a struct utimbuf:

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

The utimes() function will succeed on writable files, but utime() with a non-null argument will not succeed unless the user owns the file.

The utimbuf structure is defined in <utime.h>. It contains the following two members:

time_t actime; /* access time */
time_t modtime; /* modification time */