*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: gettimeofday | Section: 2 | Source: Digital UNIX | File: gettimeofday.2.gz
gettimeofday(2) System Calls Manual gettimeofday(2) NAME gettimeofday, settimeofday, ftime - Gets and sets date and time LIBRARY Standard C Library (libc.so, libc.a) SYNOPSIS #include <sys/time.h> int gettimeofday( struct timeval *tp, void *tzp); #include <sys/timeb.h> int ftime( struct timeb *tp); The following function declarations do not conform to current standards and are supported only for backward compatibility: #include <sys/time.h> int gettimeofday( struct timeval *tp, struct timezone *tzp); int settimeofday( struct timeval *tp, struct timezone *tzp); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: gettimeofday(), ftime(): XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS For gettimeofday() and settimeofday(), points to a timeval structure, defined in the sys/time.h file. For ftime(), points to a timeb structure, defined in the sys/timeb.h file. [Digital] For the backward-compatible ver- sions of gettimeofday() and settimeofday(), points to a timezone structure, defined in the sys/time.h file. DESCRIPTION The gettimeofday(), ftime(), and settimeofday() functions get and set the time and timezone information stored in the kernel. The gettimeofday() function gets the current time, expressed in seconds and microseconds since midnight (0 hour), January 1, 1970 UTC (Coordi- nated Universal Time, formerly Greenwich Mean Time or GMT), and stores it in the timeval structure pointed to by tp. The ftime() function sets the time and millitm members of the timeb structure pointed to by tp to contain the seconds and milliseconds por- tions, respectively, of the current time in seconds since midnight (0 hour), January 1, 1970 UTC. See the NOTES section for information on the backward-compatible ver- sions of gettimeofday() and settimeofday(). See the timezone(3) reference page for information on timezone handling on DIGITAL UNIX systems. NOTES The following information applies only to the backward-compatible ver- sions of the gettimeofday() and settimeofday() functions. [Digital] The timezone structure that is returned for the gettimeof- day() call is set at boot time by the /sbin/init.d/settime script. The tz_minuteswest field of the structure is set to your local time zone. This field is set only for backward compatibility with older applica- tions that may use the gettimeofday() call for timezone information. The tz_dsttime field is set to zero because this field is obsolete. [Digital] On SVID2-compatible systems, local timezone information is maintained in the kernel, although the information is not as accurate or as complete as the information that can be maintained at user level. On these systems, you can use the tzp parameter with gettimeofday() and settimeofday() to get and set timezone information in addition to the time. The tzp parameter returns a pointer to a timezone structure that contains the local timezone expressed in minutes of time westward from Greenwich and a flag that, when nonzero, indicates that daylight sav- ings time applies locally during some part of the year. Note that, if the tzp parameter is set to NULL, timezone information is not returned or set. [Digital] A process must have the sysattr effective privilege to use settimeofday(). RETURN VALUES Upon successful completion, a value of 0 (zero) is returned. Other- wise, -1 is returned and errno is set to indicate the error. ERRORS If the gettimeofday() or settimeofday() function fails, errno may be set the following value: [Digital] A parameter points to an invalid address. [Digital] The process's effective user ID does not have the sysattr effective privilege, which is required for using settimeof- day(). RELATED INFORMATION Functions: adjtime(2), ctime(3), getclock(3), gettimer(3), setclock(3), strftime(3), timezone(3) Files: tzfile(4) Commands: date(1), zdump(8), zic(8) Standards: standards(5) delim off gettimeofday(2)

Navigation Options