OSDN Git Service

bc2eacae12c52b2ae58c66c9075f5f0ad448dfe6
[linuxjm/LDP_man-pages.git] / original / man2 / time.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified Sat Jul 24 14:13:40 1993 by Rik Faith <faith@cs.unc.edu>
27 .\" Additions by Joseph S. Myers <jsm28@cam.ac.uk>, 970909
28 .\"
29 .TH TIME 2 2010-02-25 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 time \- get time in seconds
32 .SH SYNOPSIS
33 .B #include <time.h>
34 .sp
35 .BI "time_t time(time_t *" t );
36 .SH DESCRIPTION
37 .BR time ()
38 returns the time as the number of seconds since the
39 Epoch, 1970-01-01 00:00:00 +0000 (UTC).
40
41 If
42 .I t
43 is non-NULL,
44 the return value is also stored in the memory pointed to by
45 .IR t .
46 .SH "RETURN VALUE"
47 On success, the value of time in seconds since the Epoch is returned.
48 On error, \fI((time_t)\ \-1)\fP is returned, and \fIerrno\fP is set
49 appropriately.
50 .SH ERRORS
51 .TP
52 .B EFAULT
53 .I t
54 points outside your accessible address space.
55 .SH "CONFORMING TO"
56 SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
57 .\" .br
58 .\" Under 4.3BSD, this call is obsoleted by
59 .\" .BR gettimeofday (2).
60 POSIX does not specify any error conditions.
61 .SH NOTES
62 POSIX.1 defines
63 .I seconds since the Epoch
64 as a value to be interpreted as the number of seconds between a
65 specified time and the Epoch, according to a formula for conversion
66 from UTC equivalent to conversion on the naive basis that leap
67 seconds are ignored and all years divisible by 4 are leap years.
68 This value is not the same as the actual number of seconds between the time
69 and the Epoch, because of leap seconds and because clocks are not
70 required to be synchronized to a standard reference.
71 The intention is
72 that the interpretation of seconds since the Epoch values be
73 consistent; see POSIX.1 Annex B 2.2.2 for further rationale.
74 .SH "SEE ALSO"
75 .BR date (1),
76 .BR gettimeofday (2),
77 .BR ctime (3),
78 .BR ftime (3),
79 .BR time (7)