minix3/man/man2/time.2

63 lines
1.4 KiB
Groff

.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" @(#)gettimeofday.2 6.7 (Berkeley) 5/14/86
.\"
.TH TIME 2 "May 14, 1986"
.UC 4
.SH NAME
time, stime \- get/set date and time
.SH SYNOPSIS
.nf
.ft B
#include <sys/types.h>
#include <time.h>
time_t time(time_t *\fItp\fP)
int stime(time_t *\fItp\fP)
.fi
.SH DESCRIPTION
The system's notion of the current Greenwich time
is obtained with the
.B time
call, and set with the
.B stime
call.
The time is expressed
in seconds since midnight (0 hour), January 1, 1970.
The time is both returned by
.B time
and stored in the variable pointed to by
.I tp
unless
.I tp
is the null pointer.
.PP
.B Stime
obtains the time to set from the variable pointed to by
.IR tp .
.PP
Only the super-user may set the time of day.
.SH RETURN
A 0 return value from
.B stime
indicates that the call succeeded.
.B Time
returns the current time on success.
A \-1 return value indicates an error occurred, and in this
case an error code is stored into the global variable \fBerrno\fP.
.SH "ERRORS
The following error codes may be set in \fBerrno\fP:
.TP 15
[EFAULT]
The
.I tp
address referenced invalid memory.
.TP 15
[EPERM]
A user other than the super-user attempted to set the time.
.SH "SEE ALSO"
.BR date (1),
.BR ctime (3).