]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ftime.3
epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, ioprio_set.2, signalfd.2, spu_c...
[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.\"
6a8d8745 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.\"
513051f7 30.TH FTIME 3 2010-02-25 "GNU" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32ftime \- return date and time
33.SH SYNOPSIS
34.B "#include <sys/timeb.h>"
35.sp
36.BI "int ftime(struct timeb *" tp );
37.SH DESCRIPTION
f49c451a
MW
38This function returns the current time as seconds and milliseconds
39since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
cb772f76 40The time is returned in
fea681da
MK
41.IR tp ,
42which is declared as follows:
43.sp
a08ea57c 44.in +4n
fea681da
MK
45.nf
46struct timeb {
cab87712 47 time_t time;
7295b7ed 48 unsigned short millitm;
cab87712
MK
49 short timezone;
50 short dstflag;
fea681da
MK
51};
52.fi
a08ea57c 53.in
fea681da 54.LP
be9634cf 55Here \fItime\fP is the number of seconds since the Epoch,
cb772f76
MK
56and \fImillitm\fP is the number of milliseconds since \fItime\fP
57seconds since the Epoch.
5b0dc1ba 58The \fItimezone\fP field is the local timezone measured in minutes
cb772f76
MK
59of time west of Greenwich (with a negative value indicating minutes
60east of Greenwich).
61The \fIdstflag\fP field
c7094399 62is a flag that, if nonzero, indicates that Daylight Saving time
fea681da
MK
63applies locally during the appropriate part of the year.
64.LP
cb772f76
MK
65POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
66fields are unspecified; avoid relying on them.
47297adb 67.SH RETURN VALUE
fea681da 68This function always returns 0.
cb772f76 69(POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
47297adb 70.SH CONFORMING TO
2b2581ee 714.2BSD, POSIX.1-2001.
2f0526ae
MK
72POSIX.1-2008 removes the specification of
73.BR ftime ().
4aeb80ed 74
c13182ef
MK
75This function is obsolete.
76Don't use it.
77If the time in seconds
fea681da
MK
78suffices,
79.BR time (2)
80can be used;
81.BR gettimeofday (2)
82gives microseconds;
0eb44391 83.BR clock_gettime (2)
4aeb80ed
MK
84gives nanoseconds but is not as widely available.
85.SH BUGS
fea681da
MK
86.LP
87Under libc4 and libc5 the \fImillitm\fP field is meaningful.
88But early glibc2 is buggy and returns 0 there;
89glibc 2.1.1 is correct again.
889829be
MK
90.\" .SH HISTORY
91.\" The
92.\" .BR ftime ()
93.\" function appeared in 4.2BSD.
47297adb 94.SH SEE ALSO
fea681da
MK
95.BR gettimeofday (2),
96.BR time (2)