

This page is part of release 5.05 of the Linux man-pages project. SEE ALSOĬhattr(1), touch(1), futimesat(2), stat(2), utimensat(2), futimens(3), futimes(3), inode(7) COLOPHON Linux does not allow changing the timestamps on an immutable file, or setting the timestamps to something other than the current time on an append-only file. Times is not NULL, the caller’s effective UID does not match the owner of the file, and the caller is not privileged (Linux: does not have the CAP_FOWNER capability). Times is NULL, the caller’s effective user ID does not match the owner of the file, the caller does not have write access to the file, and the caller is not privileged (Linux: does not have either the CAP_DAC_OVERRIDE or the CAP_FOWNER capability).

Search permission is denied for one of the directories in the path prefix of path (see also path_resolution(7)).

On error, −1 is returned, and errno is set appropriately. If times is NULL, then analogously to utime(), the access and modification times of the file are set to the current time. Times specifies the new access time, and times specifies the new modification time. The elements of this array are timeval structures, which allow a precision of 1 microsecond for specifying timestamps. The utimes() system call is similar, but the times argument refers to an array rather than a structure. The utime() system call allows specification of timestamps with a resolution of 1 second. If times is NULL, then the access and modification times of the file are set to the current time.Ĭhanging timestamps is permitted when: either the process has appropriate privileges, or the effective user ID equals the user ID of the file, or times is NULL and the process has write permission for the file. The utime() system call changes the access and modification times of the inode specified by filename to the actime and modtime fields of times respectively. Note: modern applications may prefer to use the interfaces described in utimensat(2). Int utimes(const char * filename, const struct timeval times ) DESCRIPTION Int utime(const char * filename, const struct utimbuf * times ) The effective user ID of the process must match the owner of the file, or the process must have write permission to the file or have super user privileges. If times is NULL, the access and modification times of the file are set to the current time. Utime, utimes − change file last access and modification times SYNOPSIS The utime function sets the access and modification times of the file named by the path argument.
