1UTIMES(3P) POSIX Programmer's Manual UTIMES(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 utimes - set file access and modification times (LEGACY)
13
15 #include <sys/time.h>
16
17 int utimes(const char *path, const struct timeval times[2]);
18
19
21 The utimes() function shall set the access and modification times of
22 the file pointed to by the path argument to the value of the times
23 argument. The utimes() function allows time specifications accurate to
24 the microsecond.
25
26 For utimes(), the times argument is an array of timeval structures. The
27 first array member represents the date and time of last access, and the
28 second member represents the date and time of last modification. The
29 times in the timeval structure are measured in seconds and microseconds
30 since the Epoch, although rounding toward the nearest second may occur.
31
32 If the times argument is a null pointer, the access and modification
33 times of the file shall be set to the current time. The effective user
34 ID of the process shall match the owner of the file, or has write
35 access to the file or appropriate privileges to use this call in this
36 manner. Upon completion, utimes() shall mark the time of the last file
37 status change, st_ctime, for update.
38
40 Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
41 returned and errno shall be set to indicate the error, and the file
42 times shall not be affected.
43
45 The utimes() function shall fail if:
46
47 EACCES Search permission is denied by a component of the path prefix;
48 or the times argument is a null pointer and the effective user
49 ID of the process does not match the owner of the file and write
50 access is denied.
51
52 ELOOP A loop exists in symbolic links encountered during resolution of
53 the path argument.
54
55 ENAMETOOLONG
56 The length of the path argument exceeds {PATH_MAX} or a pathname
57 component is longer than {NAME_MAX}.
58
59 ENOENT A component of path does not name an existing file or path is an
60 empty string.
61
62 ENOTDIR
63 A component of the path prefix is not a directory.
64
65 EPERM The times argument is not a null pointer and the calling
66 process' effective user ID has write access to the file but does
67 not match the owner of the file and the calling process does not
68 have the appropriate privileges.
69
70 EROFS The file system containing the file is read-only.
71
72
73 The utimes() function may fail if:
74
75 ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during
76 resolution of the path argument.
77
78 ENAMETOOLONG
79 Pathname resolution of a symbolic link produced an intermediate
80 result whose length exceeds {PATH_MAX}.
81
82
83 The following sections are informative.
84
86 None.
87
89 For applications portability, the utime() function should be used to
90 set file access and modification times instead of utimes().
91
93 None.
94
96 This function may be withdrawn in a future version.
97
99 utime(), the Base Definitions volume of IEEE Std 1003.1-2001,
100 <sys/time.h>
101
103 Portions of this text are reprinted and reproduced in electronic form
104 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
105 -- Portable Operating System Interface (POSIX), The Open Group Base
106 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
107 Electrical and Electronics Engineers, Inc and The Open Group. In the
108 event of any discrepancy between this version and the original IEEE and
109 The Open Group Standard, the original IEEE and The Open Group Standard
110 is the referee document. The original Standard can be obtained online
111 at http://www.opengroup.org/unix/online.html .
112
113
114
115IEEE/The Open Group 2003 UTIMES(3P)