Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

setclock(3) [osf1 man page]

setclock(3)						     Library Functions Manual						       setclock(3)

NAME
setclock - Sets value of system-wide clock LIBRARY
Standard C Library (libc.a) SYNOPSIS
#include <sys/timers.h> int setclock( int clktyp, struct timespec *val) ; PARAMETERS
Specifies a system-wide clock whose symbolic name must be TIMEOFDAY. Points to the location where the value of the time to set into the clock specified by the clktyp parameter is stored. DESCRIPTION
The setclock() function sets a time value into the system-wide clock whose symbolic name is specified by the clktyp parameter, which must be TIMEOFDAY, defined in the sys/timers.h header file. The source of the current value of time set into the system-wide time-of-day clock by this function is stored in space reserved by a type timespec structure pointed to by the val parameter. This time information is the amount of time since the epoch. The epoch is referenced to 00:00:00 GMT (Greenwich Mean Time) 1 Jan 1970. The timespec structure, which is also defined in the sys/timers.h header file has the fol- lowing members: unsigned long tv_sec Time of day since the epoch in seconds. long tv_nsec Time of day fraction of a second (expressed in nanoseconds). NOTES
Trial use RETURN VALUES
Upon successful completion, the setclock() function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the setclock() function fails, errno may be set to one of the following values: The clktyp parameter does not specify a known system- wide clock, the information pointed to by the val parameter is outside the permissible range for the clock specified by the clktyp parame- ter, or a nanosecond value less than zero or greater than or equal to 1000 million is specified by the information pointed to by the val parameter. An error occurred while accessing the clock specified by the clktyp parameter. The requesting process does not have the appro- priate privilege to set the clock specified by the clktyp parameter. RELATED INFORMATION
Functions: getclock(3), gettimer(3), time(3) delim off setclock(3)

Check Out this Related Man Page

clock_gettime(3)					     Library Functions Manual						  clock_gettime(3)

NAME
clock_gettime, clock_settime - Obtains or sets the time for the specified clock (P1003.1b) LIBRARY
Realtime Library (librt.so, librt.a) SYNOPSIS
#include <time.h> int clock_gettime ( clockid_t clock_id, struct timespec *tp); int clock_settime ( clockid_t clock_id, const struct timespec *tp); PARAMETERS
clock_id The clock type used to obtain the time for the clock that is set. The CLOCK_REALTIME clock is supported and represents the TIME-OF-DAY clock for the system. *tp A pointer to a timespec data structure. DESCRIPTION
The clock_gettime function returns the current time (in seconds and nanoseconds) for the specified clock. The clock_settime function sets the specified clock. The CLOCK_REALTIME clock measures the amount of time elapsed since 00:00:00:00 January 1, 1970 Greenwich Mean Time (GMT), otherwise known as the Epoch. Time values that fall between two non-negative integer multiples of the resolution are truncated down to the smaller multiple of the resolution. You must have superuser privileges to use the clock_settime function. RETURN VALUES
On a successful call to the clock_gettime or clock_settime functions, a value of 0 (zero) is returned. On an unsuccessful call, a value of -1 is returned and errno is set to indicate that an error occurred. ERRORS
The clock_gettime and clock_settime functions fail under the following conditions: [EINVAL] The clock_id argument does not specify a known clock. The value pointed to by the tp argument to the clock_settime function is outside the range for the given clock_id. The tp argument specified a nanosecond value less than zero or greater than or equal to 1000 million. [EPERM] The requesting process does not have the appropriate privilege to set the specified clock. RELATED INFORMATION
Functions: time(1), clock_getres(3), ctime(3), timer_gettime(3) Guide to Realtime Programming delim off clock_gettime(3)
Man Page