Rev | Line | |
---|
[9] | 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.7 (Berkeley) 5/14/86
|
---|
| 6 | .\"
|
---|
| 7 | .TH TIME 2 "May 14, 1986"
|
---|
| 8 | .UC 4
|
---|
| 9 | .SH NAME
|
---|
| 10 | time, stime \- get/set date and time
|
---|
| 11 | .SH SYNOPSIS
|
---|
| 12 | .nf
|
---|
| 13 | .ft B
|
---|
| 14 | #include <sys/types.h>
|
---|
| 15 | #include <time.h>
|
---|
| 16 |
|
---|
| 17 | time_t time(time_t *\fItp\fP)
|
---|
| 18 | int stime(time_t *\fItp\fP)
|
---|
| 19 | .fi
|
---|
| 20 | .SH DESCRIPTION
|
---|
| 21 | The system's notion of the current Greenwich time
|
---|
| 22 | is obtained with the
|
---|
| 23 | .B time
|
---|
| 24 | call, and set with the
|
---|
| 25 | .B stime
|
---|
| 26 | call.
|
---|
| 27 | The time is expressed
|
---|
| 28 | in seconds since midnight (0 hour), January 1, 1970.
|
---|
| 29 | The time is both returned by
|
---|
| 30 | .B time
|
---|
| 31 | and stored in the variable pointed to by
|
---|
| 32 | .I tp
|
---|
| 33 | unless
|
---|
| 34 | .I tp
|
---|
| 35 | is the null pointer.
|
---|
| 36 | .PP
|
---|
| 37 | .B Stime
|
---|
| 38 | obtains the time to set from the variable pointed to by
|
---|
| 39 | .IR tp .
|
---|
| 40 | .PP
|
---|
| 41 | Only the super-user may set the time of day.
|
---|
| 42 | .SH RETURN
|
---|
| 43 | A 0 return value from
|
---|
| 44 | .B stime
|
---|
| 45 | indicates that the call succeeded.
|
---|
| 46 | .B Time
|
---|
| 47 | returns the current time on success.
|
---|
| 48 | A \-1 return value indicates an error occurred, and in this
|
---|
| 49 | case an error code is stored into the global variable \fBerrno\fP.
|
---|
| 50 | .SH "ERRORS
|
---|
| 51 | The following error codes may be set in \fBerrno\fP:
|
---|
| 52 | .TP 15
|
---|
| 53 | [EFAULT]
|
---|
| 54 | The
|
---|
| 55 | .I tp
|
---|
| 56 | address referenced invalid memory.
|
---|
| 57 | .TP 15
|
---|
| 58 | [EPERM]
|
---|
| 59 | A user other than the super-user attempted to set the time.
|
---|
| 60 | .SH "SEE ALSO"
|
---|
| 61 | .BR date (1),
|
---|
| 62 | .BR ctime (3).
|
---|
Note:
See
TracBrowser
for help on using the repository browser.