- General description Function utime sets the access and modification times of pathname to the values in the utimbuf structure. If newtimes is a NULL pointer.
- Utime.time ΒΆ Returns the number of seconds, as an integer, since the Epoch, assuming that underlying RTC is set and maintained as decsribed above. If an RTC is not set, this function returns number of seconds since a port-specific reference point in time (for embedded boards without a battery-backed RTC, usually since power up or reset).
- 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. If times is NULL, then the access and modification times of the file are set to the current time.
Shenzhen luen generation technology co., LTD. Was established in June 2008, headquarters is located in nanshan district of shenzhen software industry base. The utime system call allows specification of timestamps with a resolution of 1 second. The utimes system call is similar, but the times argument refers to an array rather than a structure. The elements of this array are timeval structures, which allow a precision of 1 microsecond for specifying timestamps. The timeval structure is.
Name
utime, utimes - change file last access and modification times
Synopsis
Description
The utime() system call changes the access and modification times of the inode specified by filename to the actime and modtimefields of times respectively.
If times is NULL, then the access and modification times of the file are set to the current time.
Changing timestamps is permitted when: either the process has appropriate privileges, or the effective user ID equals the user ID of the file, ortimes is NULL and the process has write permission for the file.
The utimbuf structure is:
The utime() system call allows specification of timestamps with a resolution of 1 second.The utimes() system call is similar, but the times argument refers to an array rather than a structure. The elements of this array aretimeval structures, which allow a precision of 1 microsecond for specifying timestamps. The timeval structure is:
Time Calculator
Return Value
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
Errors
EACCESSearch permission is denied for one of the directories in the path prefix of path (see also path_resolution(7)).
EACCES
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 calleris not privileged (Linux: does not have either the CAP_DAC_OVERRIDE or the CAP_FOWNER capability).
ENOENT
filename does not exist.
EPERM
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 theCAP_FOWNER capability).
EROFS
path resides on a read-only file system.
Conforming To
utime(): SVr4, POSIX.1-2001. POSIX.1-2008 marks utime() as obsolete.
utimes(): 4.3BSD, POSIX.1-2001.
Notes
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-onlyfile.
In libc4 and libc5, utimes() is just a wrapper for utime() and hence does not allow a subsecond resolution.
See Also
chattr(1), futimesat(2), stat(2), utimensat(2), futimens(3), futimes(3)
Referenced By
capabilities(7),explain(1),explain(3),explain_utime(3),explain_utime_or_die(3),file(1),indent(1),libmagic(3),localtime(3),mount(8),perlfunc(1),perltoc(1),spax(1),tar_extract_regfile(3),Local News Albany Ny
time(7)Changes the access and modification times on each file of a list of files. The first two elements of the list must be the NUMERIC access and modification times, in that order. Returns the number of files successfully changed. The inode change time of each file is set to the current time. For example, this code has the same effect as the Unix touch(1) command when the files already exist and belong to the user running the program:
Since Perl 5.8.0, if the first two elements of the list are undef
, the utime(2) syscall from your C library is called with a null second argument. On most systems, this will set the file's access and modification times to the current time (i.e., equivalent to the example above) and will work even on files you don't own provided you have write permission:
Under NFS this will use the time of the NFS server, not the time of the local machine. If there is a time synchronization problem, the NFS server and local machine will have different times. The Unix touch(1) command will in fact normally use this form instead of the one shown in the first example.
Timer Online Stopwatch
Passing only one of the first two elements as undef
is equivalent to passing a 0 and will not have the effect described when both are undef
. This also triggers an uninitialized warning.
Times Of India
On systems that support futimes(2), you may pass filehandles among the files. On systems that don't support futimes(2), passing filehandles raises an exception. Filehandles must be passed as globs or glob references to be recognized; barewords are considered filenames.
Utime Gmod
Portability issues: 'utime' in perlport.