mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-27 16:31:19 +00:00
114 lines
3.8 KiB
Groff
114 lines
3.8 KiB
Groff
.\" Copyright (c) 1980, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)gettimeofday.2 8.1 (Berkeley) 6/4/93
|
|
.\"
|
|
.TH GETTIMEOFDAY 2 "22 January 1997" GNO "System Calls"
|
|
.SH NAME
|
|
.BR gettimeofday ,
|
|
.BR settimeofday
|
|
\- get/set date and time
|
|
.SH SYNOPSIS
|
|
#include <sys/time.h>
|
|
.sp 1
|
|
int
|
|
\fBgettimeofday\fR (struct timeval *\fItp\fR, struct timezone *\fItzp\fR);
|
|
.sp 1
|
|
int
|
|
\fBsettimeofday\fR (struct timeval *\fItp\fR, struct timezone *\fItzp\fR);
|
|
.SH DESCRIPTION
|
|
The system's notion of the current Greenwich time and the current time
|
|
zone is obtained with the
|
|
.BR gettimeofday
|
|
call, and set with the
|
|
.BR settimeofday
|
|
call. The time is expressed in seconds and microseconds
|
|
since midnight (0 hour), January 1, 1970. The resolution of the system
|
|
clock is hardware dependent, and the time may be updated continuously or
|
|
in ``ticks.'' If
|
|
.I tp
|
|
or
|
|
.I tzp
|
|
is NULL, the associated time
|
|
information will not be returned or set.
|
|
.LP
|
|
The structures pointed to by
|
|
.I tp
|
|
and
|
|
.I tzp
|
|
are defined in <sys/time.h> as:
|
|
.nf
|
|
|
|
struct timeval {
|
|
long tv_sec; /* seconds since Jan. 1, 1970 */
|
|
long tv_usec; /* and microseconds */
|
|
};
|
|
|
|
struct timezone {
|
|
int tz_minuteswest; /* of Greenwich */
|
|
int tz_dsttime; /* type of dst correction to apply */
|
|
};
|
|
.fi
|
|
.LP
|
|
The
|
|
.I timezone
|
|
structure indicates the local time zone
|
|
(measured in minutes of time westward from Greenwich),
|
|
and a flag that, if nonzero, indicates that
|
|
Daylight Saving time applies locally during
|
|
the appropriate part of the year.
|
|
.LP
|
|
Only the super-user may set the time of day or time zone.
|
|
.SH RETURN
|
|
A 0 return value indicates that the call succeeded.
|
|
A -1 return value indicates an error occurred, and in this
|
|
case an error code is stored into the global variable
|
|
.IR errno .
|
|
.SH BUGS
|
|
For GNO,
|
|
.BR settimeofday
|
|
is not currently implemented.
|
|
.BR gettimeofday
|
|
is a minimal implementation that stores into \fItp\fR->sec the
|
|
value returned by
|
|
.BR time (2).
|
|
The \fItp\fR->usec field is set to zero.
|
|
.SH SEE ALSO
|
|
.BR date (1),
|
|
.BR adjtime (2),
|
|
.BR ctime (3),
|
|
.BR clocks (7),
|
|
.BR timed (8)
|
|
.SH HISTORY
|
|
The
|
|
.BR settimeofday
|
|
function call appeared in 4.2BSD.
|