mount_setattr.2: Minor tweaks to Christian's patch
[man-pages.git] / man3 / ftime.3
blob8c336e0a3621cbc91d1072fa45cd440383769141
1 .\" Copyright (c) 1993 Michael Haardt
2 .\" (michael@moria.de)
3 .\" Fri Apr  2 11:32:09 MET DST 1993
4 .\"
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
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
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
24 .\" %%%LICENSE_END
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)
28 .\" 2008-06-23, mtk, minor rewrites, added some details
29 .\"
30 .TH FTIME 3 2021-03-22 "GNU" "Linux Programmer's Manual"
31 .SH NAME
32 ftime \- return date and time
33 .SH SYNOPSIS
34 .nf
35 .B "#include <sys/timeb.h>"
36 .PP
37 .BI "int ftime(struct timeb *" tp );
38 .fi
39 .SH DESCRIPTION
40 .BR NOTE :
41 This function is no longer provided by the GNU C library.
42 Use
43 .BR clock_gettime (2)
44 instead.
45 .PP
46 This function returns the current time as seconds and milliseconds
47 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
48 The time is returned in
49 .IR tp ,
50 which is declared as follows:
51 .PP
52 .in +4n
53 .EX
54 struct timeb {
55     time_t         time;
56     unsigned short millitm;
57     short          timezone;
58     short          dstflag;
60 .EE
61 .in
62 .PP
63 Here \fItime\fP is the number of seconds since the Epoch,
64 and \fImillitm\fP is the number of milliseconds since \fItime\fP
65 seconds since the Epoch.
66 The \fItimezone\fP field is the local timezone measured in minutes
67 of time west of Greenwich (with a negative value indicating minutes
68 east of Greenwich).
69 The \fIdstflag\fP field
70 is a flag that, if nonzero, indicates that Daylight Saving time
71 applies locally during the appropriate part of the year.
72 .PP
73 POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
74 fields are unspecified; avoid relying on them.
75 .SH RETURN VALUE
76 This function always returns 0.
77 (POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
78 .SH VERSIONS
79 Starting with glibc 2.33, the
80 .BR ftime ()
81 function and the
82 .I <sys/timeb.h>
83 header have been removed.
84 To support old binaries,
85 glibc continues to provide a compatibility symbol for
86 applications linked against glibc 2.32 and earlier.
87 .SH ATTRIBUTES
88 For an explanation of the terms used in this section, see
89 .BR attributes (7).
90 .ad l
91 .nh
92 .TS
93 allbox;
94 lbx lb lb
95 l l l.
96 Interface       Attribute       Value
98 .BR ftime ()
99 T}      Thread safety   MT-Safe
103 .sp 1
104 .SH CONFORMING TO
105 4.2BSD, POSIX.1-2001.
106 POSIX.1-2008 removes the specification of
107 .BR ftime ().
109 This function is obsolete.
110 Don't use it.
111 If the time in seconds
112 suffices,
113 .BR time (2)
114 can be used;
115 .BR gettimeofday (2)
116 gives microseconds;
117 .BR clock_gettime (2)
118 gives nanoseconds but is not as widely available.
119 .SH BUGS
120 Early glibc2 is buggy and returns 0 in the
121 .I millitm
122 field;
123 glibc 2.1.1 is correct again.
124 .\" .SH HISTORY
125 .\" The
126 .\" .BR ftime ()
127 .\" function appeared in 4.2BSD.
128 .SH SEE ALSO
129 .BR gettimeofday (2),
130 .BR time (2)