]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ftime.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / ftime.3
CommitLineData
fea681da
MK
1.\" Copyright (c) 1993 Michael Haardt
2.\" (michael@moria.de)
3.\" Fri Apr 2 11:32:09 MET DST 1993
4.\"
1dd72f9c 5.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
6.\" This is free documentation; you can redistribute it and/or
7.\" modify it under the terms of the GNU General Public License as
8.\" published by the Free Software Foundation; either version 2 of
9.\" the License, or (at your option) any later version.
10.\"
11.\" The GNU General Public License's references to "object code"
12.\" and "executables" are to be interpreted as the output of any
13.\" document formatting or typesetting system, including
14.\" intermediate and printed output.
15.\"
16.\" This manual is distributed in the hope that it will be useful,
17.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19.\" GNU General Public License for more details.
20.\"
21.\" You should have received a copy of the GNU General Public
c715f741
MK
22.\" License along with this manual; if not, see
23.\" <http://www.gnu.org/licenses/>.
6a8d8745 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Modified Sat Jul 24 14:23:14 1993 by Rik Faith (faith@cs.unc.edu)
27.\" Modified Sun Oct 18 17:31:43 1998 by Andries Brouwer (aeb@cwi.nl)
cb772f76 28.\" 2008-06-23, mtk, minor rewrites, added some details
fea681da 29.\"
6b621d05 30.TH FTIME 3 2020-02-09 "GNU" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32ftime \- return date and time
33.SH SYNOPSIS
34.B "#include <sys/timeb.h>"
68e4db0a 35.PP
fea681da
MK
36.BI "int ftime(struct timeb *" tp );
37.SH DESCRIPTION
0f18a233
MK
38.BR NOTE :
39This function is deprecated, and will be removed in a future version of
40the GNU C library.
41Use
42.BR clock_gettime (2)
43instead.
44.PP
f49c451a
MW
45This function returns the current time as seconds and milliseconds
46since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
cb772f76 47The time is returned in
fea681da
MK
48.IR tp ,
49which is declared as follows:
51f5698d 50.PP
a08ea57c 51.in +4n
b8302363 52.EX
fea681da 53struct timeb {
cab87712 54 time_t time;
7295b7ed 55 unsigned short millitm;
cab87712
MK
56 short timezone;
57 short dstflag;
fea681da 58};
b8302363 59.EE
a08ea57c 60.in
dd3568a1 61.PP
be9634cf 62Here \fItime\fP is the number of seconds since the Epoch,
cb772f76
MK
63and \fImillitm\fP is the number of milliseconds since \fItime\fP
64seconds since the Epoch.
5b0dc1ba 65The \fItimezone\fP field is the local timezone measured in minutes
cb772f76
MK
66of time west of Greenwich (with a negative value indicating minutes
67east of Greenwich).
68The \fIdstflag\fP field
c7094399 69is a flag that, if nonzero, indicates that Daylight Saving time
fea681da 70applies locally during the appropriate part of the year.
dd3568a1 71.PP
cb772f76
MK
72POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
73fields are unspecified; avoid relying on them.
47297adb 74.SH RETURN VALUE
fea681da 75This function always returns 0.
cb772f76 76(POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
53d029b3 77.SH ATTRIBUTES
21576164
MK
78For an explanation of the terms used in this section, see
79.BR attributes (7).
80.TS
81allbox;
82lb lb lb
83l l l.
84Interface Attribute Value
85T{
53d029b3 86.BR ftime ()
21576164
MK
87T} Thread safety MT-Safe
88.TE
47297adb 89.SH CONFORMING TO
2b2581ee 904.2BSD, POSIX.1-2001.
2f0526ae
MK
91POSIX.1-2008 removes the specification of
92.BR ftime ().
847e0d88 93.PP
c13182ef
MK
94This function is obsolete.
95Don't use it.
96If the time in seconds
fea681da
MK
97suffices,
98.BR time (2)
99can be used;
100.BR gettimeofday (2)
101gives microseconds;
0eb44391 102.BR clock_gettime (2)
4aeb80ed
MK
103gives nanoseconds but is not as widely available.
104.SH BUGS
dd3568a1 105.PP
eb4a2faa
MK
106Early glibc2 is buggy and returns 0 in the
107.I millitm
108field;
fea681da 109glibc 2.1.1 is correct again.
889829be
MK
110.\" .SH HISTORY
111.\" The
112.\" .BR ftime ()
113.\" function appeared in 4.2BSD.
47297adb 114.SH SEE ALSO
fea681da
MK
115.BR gettimeofday (2),
116.BR time (2)