Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
utimes, utimes64 - set file access time and file modification time
&pagelevel(4)&pagelevel
Syntax | #include <sys/time.h> int utimes(const char *path, const struct timeval times[2]); CRTE111A30 int utimes64(const char *path, const struct timeval64 times[2]); (End) |
Description | utimes() sets the access and modification times of the file pointed to by path to the values specified in times. The function allows time specifications accurate to the microsecond.
The times argument is an array consisting of two structures of type timeval . The access time is set to the value of the first element and the modification time to the value of the second element. The times in the timeval structure are measured in seconds and microseconds since 00:00:00 GMT, January 1, 1970 (see utime.h ). If times is the null pointer, the access and modification times are set to the current time. If utimes() is to be used in this way, the process must be the owner of the file, must have write permission for the file or must be a process with special permissions. On successful completion, utimes() marks the st_ctime field for update (see sys/stat.h ). The function utimes64() behaves like the function utimes() , except that it uses the structure timeval 64 instead of the structure timeval and therefore can process timestamps beyond 01/19/2038 03:14:07 UTC. |
Return val. | 0 | if successful. |
| -1 | if an error occurs. errno is set to indicate the error. |
Errors | utimes() and utimes64() will fail if:
|
| EACCES
| Search permission is denied for a component of the path, or times is a null pointer and the effective user ID is not that of the system administrator or the owner of the file, and write access is refused. |
| Extension |
| EFAULT
| times is non-zero and points outside the allocated address space, or path points outside the allocated address space of the process. |
| EINTR
| A signal was caught during the utimes() resp. utimes64() system call. |
| EINVAL
| An attempt was made to access a BS2000 file. |
| ELOOP
| Too many symbolic links were encountered in resolving path. (End) |
| ENAMETOOLONG
|
|
| The length of path exceeds {PATH_MAX} or the length of a component of path exceeds{NAME_MAX} . |
| ENOENT
| The named file does not exist. |
| ENOTDIR
| A component of the path is not a directory. |
| EPERM
| The effective user ID is not that of the system administrator or the user of the file, and times is not zero. |
| EROFS
| The file system containing the file is mounted as a read-only file system. |
| utimes64() fails when the following applies:
|
| ENOSYS
| POSIX-BC correction status < A47. |
See also | sys/time.h .
|