1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1995-06-10 by Andries Brouwer <aeb@cwi.nl>
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk-manpages@gmx.net>
29 .\" Modified 2004-10-10 by Andries Brouwer <aeb@cwi.nl>
31 .TH UTIME 2 2004-10-10 "Linux" "Linux Programmer's Manual"
33 utime, utimes \- change access and/or modification times of an inode
36 .B #include <sys/types.h>
40 .BI "int utime(const char *" filename ", const struct utimbuf *" buf );
42 .B #include <sys/time.h>
44 .BI "int utimes(const char *" filename ", const struct timeval " times [2]);
48 changes the access and modification times of the inode specified by
51 .IR actime " and " modtime
58 is NULL, then the access and modification times of the file are set
61 Changing time stamps is permitted when: either
62 the process has appropriate privileges (Linux: has the
64 capability), or the effective user ID equals the user ID
67 must is NULL and the process has write permission to the file.
76 time_t actime; /* access time */
77 time_t modtime; /* modification time */
84 allows specification of time stamps with a resolution of 1 second.
87 is similar, but allows a resolution of 1 microsecond.
90 refers to access time, and
101 long tv_sec; /* seconds */
102 long tv_usec; /* microseconds */
107 On success, zero is returned.
108 On error, \-1 is returned, and
110 is set appropriately.
114 Search permission is denied for one of the directories in
118 .BR path_resolution (7)),
121 is NULL and the process does not have permission to change the time stamps
130 is not NULL and the process does not have permission to change the time stamps.
134 resides on a read-only file system.
138 .\" SVr4 documents additional error conditions EFAULT,
139 .\" EINTR, ELOOP, EMULTIHOP, ENAMETOOLONG, ENOLINK, ENOLINK, ENOTDIR.
144 Linux does not allow changing the time stamps on an immutable file,
145 or setting the time stamps to something other than the current time
146 on an append-only file.
150 is just a wrapper for
152 and hence does not allow a subsecond resolution.
156 legacy, which is strange since it provides more functionality than
159 Linux is not careful to distinguish between the
164 On the other hand, POSIX.1-2001 is buggy in its error description for