Annotation of 43BSDTahoe/man/man2/gettimeofday.2, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1980 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)gettimeofday.2      6.8 (Berkeley) 4/11/87
                      6: .\"
                      7: .TH GETTIMEOFDAY 2 "April 11, 1987"
                      8: .UC 4
                      9: .SH NAME
                     10: gettimeofday, settimeofday \- get/set date and time
                     11: .SH SYNOPSIS
                     12: .nf
                     13: .ft B
                     14: #include <sys/time.h>
                     15: .PP
                     16: .ft B
                     17: gettimeofday(tp, tzp)
                     18: struct timeval *tp;
                     19: struct timezone *tzp;
                     20: .PP
                     21: .ft B
                     22: settimeofday(tp, tzp)
                     23: struct timeval *tp;
                     24: struct timezone *tzp;
                     25: .fi
                     26: .SH DESCRIPTION
                     27: The system's notion of the current Greenwich time and the current time
                     28: zone is obtained with the \fIgettimeofday\fP call, and set with the
                     29: \fIsettimeofday\fP call.  The time is expressed in seconds and microseconds
                     30: since midnight (0 hour), January 1, 1970.  The resolution of the system
                     31: clock is hardware dependent, and the time may be updated continuously or
                     32: in ``ticks.''  If \fItp\fP or \fItzp\fP is NULL, the associated time
                     33: information will not be returned or set.
                     34: .PP
                     35: The structures pointed to by
                     36: .I tp
                     37: and
                     38: .I tzp
                     39: are defined in 
                     40: .I <sys/time.h>
                     41: as:
                     42: .PP
                     43: .nf
                     44: .RS
                     45: .DT
                     46: struct timeval {
                     47:        long    tv_sec;         /* seconds since Jan. 1, 1970 */
                     48:        long    tv_usec;                /* and microseconds */
                     49: };
                     50: .sp 1
                     51: struct timezone {
                     52:        int     tz_minuteswest; /* of Greenwich */
                     53:        int     tz_dsttime;     /* type of dst correction to apply */
                     54: };
                     55: .RE
                     56: .fi
                     57: .PP
                     58: The 
                     59: .I timezone
                     60: structure indicates the local time zone
                     61: (measured in minutes of time westward from Greenwich),
                     62: and a flag that, if nonzero, indicates that
                     63: Daylight Saving time applies locally during
                     64: the appropriate part of the year.
                     65: .PP
                     66: Only the super-user may set the time of day or time zone.
                     67: .SH RETURN
                     68: A 0 return value indicates that the call succeeded.
                     69: A \-1 return value indicates an error occurred, and in this
                     70: case an error code is stored into the global variable \fIerrno\fP.
                     71: .SH "ERRORS
                     72: The following error codes may be set in \fIerrno\fP:
                     73: .TP 15
                     74: [EFAULT]
                     75: An argument address referenced invalid memory.
                     76: .TP 15
                     77: [EPERM]
                     78: A user other than the super-user attempted to set the time.
                     79: .SH "SEE ALSO"
                     80: date(1), adjtime(2), ctime(3), timed(8)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.