Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

settimeofday(2) [hpux man page]

settimeofday(2) 						System Calls Manual						   settimeofday(2)

NAME
settimeofday - set the date and time SYNOPSIS
DESCRIPTION
The function sets the current time, expressed as seconds and microseconds since Epoch, and passed as the structure pointed to by tp. The resolution of the system clock is one microsecond. Security Restrictions Setting the time of day requires the privilege (SYSATTR). Processes owned by the superuser will have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. PARAMETERS
tp A pointer to a structure in which the current time is returned. The structure includes the following members: tzp If this parameter is not a null pointer, it is interpreted as a pointer to a structure under HP-UX. The structure has the following fields: tz_minuteswest The number of minutes that the local time zone is west of Coordinated Universal Time (UTC) or Epoch. tz_dsttime A flag that, if nonzero, indicates that Daylight Savings Time (DST) applies locally during the appropriate part of the year. RETURN VALUE
returns the following values under HP-UX: Successful completion. Failure. is set to indicate the error. ERRORS
If fails, is set to the following value under HP-UX: An argument address referenced invalid memory. The member of the tp parameter to was less than zero or greater than 2^31. A user lacking appropriate privileges attempted to set the time. WARNINGS
Relying on a granularity of one microsecond may result in code that is not portable to other platforms. AUTHOR
was developed by the University of California, Berkeley, and HP. SEE ALSO
date(1), ftime(2), gettimeofday(2), stime(2), time(2), ctime(3C), privileges(5). settimeofday(2)

Check Out this Related Man Page

gettimeofday(3C)					   Standard C Library Functions 					  gettimeofday(3C)

NAME
gettimeofday, settimeofday - get or set the date and time SYNOPSIS
#include <sys/time.h> int gettimeofday(struct timeval *tp, void *tzp); int settimeofday(struct timeval *tp, void *tzp); DESCRIPTION
The gettimeofday() function gets and the settimeofday() function sets the system's notion of the current time. The current time is expressed in elapsed seconds and microseconds since 00:00 Universal Coordinated Time, January 1, 1970. The resolution of the system clock is hardware dependent; the time may be updated continuously or in clock ticks. The tp argument points to a timeval structure, which includes the following members: long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ If tp is a null pointer, the current time information is not returned or set. The TZ environment variable holds time zone information. See TIMEZONE(4). The tzp argument to gettimeofday() and settimeofday() is ignored. Only privileged processes can set the time of day. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The settimeofday() function will fail if: EINVAL The structure pointed to by tp specifies an invalid time. EPERM The {PRIV_SYS_TIME} privilege was not asserted in the effective set of the calling process. The gettimeofday() function will fail for 32-bit interfaces if: EOVERFLOW The system time has progressed beyond 2038, thus the size of the tv_sec member of the timeval structure pointed to by tp is insufficient to hold the current time in seconds. USAGE
If the tv_usec member of tp is > 500000, settimeofday() rounds the seconds upward. If the time needs to be set with better than one second accuracy, call settimeofday() for the seconds and then adjtime(2) for finer accuracy. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |gettimeofday() is Standard. | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
adjtime(2), ctime(3C), gethrtime(3C), TIMEZONE(4), attributes(5), privileges(5), standards(5) SunOS 5.10 1 Aug 2003 gettimeofday(3C)
Man Page