Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (u) utime(2)
NAME
utime - Sets file access and modification times
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <utime.h>
int utime(
const char *path,
struct utimbuf *times);
PARAMETERS
path Points to the pathname for the file. If the final component of the path parameter
names a symbolic link, the link is traversed and pathname resolution continues.
times Points to a utimbuf structure containing time values for the file.
DESCRIPTION
The utime() function sets the access and modification times of the file pointed to by the path
parameter to the value of the times parameter. It allows time specifications that are accurate to
the nearest second.
The times parameter is a pointer to a utimbuf structure, which is defined in the utime.h header
file. The actime field in this structure represents the date and time of last access, and the mod-
time field represents the date and time of last modification. The times in the utimbuf structure
are measured in seconds since the Epoch, which is 00:00:00, January 1, 1970, Coordinated
Universal Time (UTC).
If the times parameter is a null pointer, the access and modification times of the file are set to the
current time. The effective user ID of the process either must be the same as the owner of the
file, must have write access to the file, or must have appropriate privileges in order to use the call
in this manner.
If the times parameter is not a null pointer, the access and modification times are set to the values
contained in the designated structure. Only the owner of the file or a process with appropriate
privileges can use the call this way.
Upon successful completion, the utime() function marks the time of the last file status change,
st_ctime, for update.
Use on Guardian Objects
The utime() function is supported for Guardian files (that is, files within /G) that are unstructured
Enscribe files. If the utime( ) function is called for a Guardian file that has a small file label, the
label is expanded to include the st_atime and st_ctime fields and to mark them for update.
The utime() function cannot be used on a file in /G that is opened for execution. A call for such
a file fails and errno is set to [ETXTBSY].
527186-003 Hewlett-Packard Company 9−11