]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ftime.3
dist.mk, All pages: .TH: Generate date at 'make dist'
[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.\"
e4a74ca8 5.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da
MK
6.\"
7.\" Modified Sat Jul 24 14:23:14 1993 by Rik Faith (faith@cs.unc.edu)
8.\" Modified Sun Oct 18 17:31:43 1998 by Andries Brouwer (aeb@cwi.nl)
cb772f76 9.\" 2008-06-23, mtk, minor rewrites, added some details
fea681da 10.\"
ab47278f 11.TH FTIME 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
12.SH NAME
13ftime \- return date and time
cfba38f4
AC
14.SH LIBRARY
15Standard C library
16.RI ( libc ", " \-lc )
fea681da 17.SH SYNOPSIS
c7db92b9 18.nf
fea681da 19.B "#include <sys/timeb.h>"
68e4db0a 20.PP
fea681da 21.BI "int ftime(struct timeb *" tp );
c7db92b9 22.fi
fea681da 23.SH DESCRIPTION
0f18a233 24.BR NOTE :
37fac7c6 25This function is no longer provided by the GNU C library.
0f18a233
MK
26Use
27.BR clock_gettime (2)
28instead.
29.PP
f49c451a
MW
30This function returns the current time as seconds and milliseconds
31since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
cb772f76 32The time is returned in
fea681da
MK
33.IR tp ,
34which is declared as follows:
51f5698d 35.PP
a08ea57c 36.in +4n
b8302363 37.EX
fea681da 38struct timeb {
cab87712 39 time_t time;
7295b7ed 40 unsigned short millitm;
cab87712
MK
41 short timezone;
42 short dstflag;
fea681da 43};
b8302363 44.EE
a08ea57c 45.in
dd3568a1 46.PP
be9634cf 47Here \fItime\fP is the number of seconds since the Epoch,
cb772f76
MK
48and \fImillitm\fP is the number of milliseconds since \fItime\fP
49seconds since the Epoch.
5b0dc1ba 50The \fItimezone\fP field is the local timezone measured in minutes
cb772f76
MK
51of time west of Greenwich (with a negative value indicating minutes
52east of Greenwich).
53The \fIdstflag\fP field
c7094399 54is a flag that, if nonzero, indicates that Daylight Saving time
fea681da 55applies locally during the appropriate part of the year.
dd3568a1 56.PP
cb772f76
MK
57POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
58fields are unspecified; avoid relying on them.
47297adb 59.SH RETURN VALUE
fea681da 60This function always returns 0.
cb772f76 61(POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
37fac7c6
MK
62.SH VERSIONS
63Starting with glibc 2.33, the
64.BR ftime ()
65function and the
66.I <sys/timeb.h>
67header have been removed.
68To support old binaries,
704b5ab5 69glibc continues to provide a compatibility symbol for
37fac7c6 70applications linked against glibc 2.32 and earlier.
53d029b3 71.SH ATTRIBUTES
21576164
MK
72For an explanation of the terms used in this section, see
73.BR attributes (7).
c466875e
MK
74.ad l
75.nh
21576164
MK
76.TS
77allbox;
c466875e 78lbx lb lb
21576164
MK
79l l l.
80Interface Attribute Value
81T{
53d029b3 82.BR ftime ()
21576164
MK
83T} Thread safety MT-Safe
84.TE
c466875e
MK
85.hy
86.ad
87.sp 1
3113c7f3 88.SH STANDARDS
2b2581ee 894.2BSD, POSIX.1-2001.
2f0526ae
MK
90POSIX.1-2008 removes the specification of
91.BR ftime ().
847e0d88 92.PP
c13182ef
MK
93This function is obsolete.
94Don't use it.
95If the time in seconds
fea681da
MK
96suffices,
97.BR time (2)
98can be used;
99.BR gettimeofday (2)
100gives microseconds;
0eb44391 101.BR clock_gettime (2)
4aeb80ed
MK
102gives nanoseconds but is not as widely available.
103.SH BUGS
eb4a2faa
MK
104Early glibc2 is buggy and returns 0 in the
105.I millitm
106field;
fea681da 107glibc 2.1.1 is correct again.
889829be
MK
108.\" .SH HISTORY
109.\" The
110.\" .BR ftime ()
111.\" function appeared in 4.2BSD.
47297adb 112.SH SEE ALSO
fea681da
MK
113.BR gettimeofday (2),
114.BR time (2)