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