delorie.com/djgpp/doc/libc/libc_846.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <sys/time.h> int utimes(const char *file, struct timeval tvp[2]); |
This function sets the file access time as specified by
tvp[0]
, and its modification time as specified by
tvp[1]
. struct timeval
is defined as follows:
struct timeval { time_t tv_sec; long tv_usec; }; |
Note that DOS and Windows maintain the file times with 2-second
granularity. Therefore, the tv_usec
member of the argument is
always ignored, and the underlying filesystem truncates (or sometimes
rounds) the actual file time stamp to the multiple of 2 seconds.
On plain DOS, only one file time is maintained, which is arbitrarily
taken from tvp[1].tv_sec
. On Windows 9X, both times are
used, but note that most versions of Windows only use the date part and
ignore the time.
Due to limitations of DOS and Windows, you cannot set times of directories.
Zero on success, nonzero on failure.
ANSI/ISO C | No |
POSIX | No |
time_t now; struct timeval tvp[2]; time(&now); tvp[1].tv_sec = now + 100; utimes("foo.dat", tvp); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |