]>
Commit | Line | Data |
---|---|---|
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 | .\" |
4c1c5274 | 11 | .TH ftime 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
12 | .SH NAME |
13 | ftime \- return date and time | |
cfba38f4 AC |
14 | .SH LIBRARY |
15 | Standard 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 | 25 | This function is no longer provided by the GNU C library. |
0f18a233 MK |
26 | Use |
27 | .BR clock_gettime (2) | |
28 | instead. | |
29 | .PP | |
f49c451a MW |
30 | This function returns the current time as seconds and milliseconds |
31 | since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). | |
cb772f76 | 32 | The time is returned in |
fea681da MK |
33 | .IR tp , |
34 | which is declared as follows: | |
51f5698d | 35 | .PP |
a08ea57c | 36 | .in +4n |
b8302363 | 37 | .EX |
fea681da | 38 | struct 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 | 47 | Here \fItime\fP is the number of seconds since the Epoch, |
cb772f76 MK |
48 | and \fImillitm\fP is the number of milliseconds since \fItime\fP |
49 | seconds since the Epoch. | |
5b0dc1ba | 50 | The \fItimezone\fP field is the local timezone measured in minutes |
cb772f76 MK |
51 | of time west of Greenwich (with a negative value indicating minutes |
52 | east of Greenwich). | |
53 | The \fIdstflag\fP field | |
c7094399 | 54 | is a flag that, if nonzero, indicates that Daylight Saving time |
fea681da | 55 | applies locally during the appropriate part of the year. |
dd3568a1 | 56 | .PP |
cb772f76 MK |
57 | POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP |
58 | fields are unspecified; avoid relying on them. | |
47297adb | 59 | .SH RETURN VALUE |
fea681da | 60 | This function always returns 0. |
cb772f76 | 61 | (POSIX.1-2001 specifies, and some systems document, a \-1 error return.) |
37fac7c6 MK |
62 | .SH VERSIONS |
63 | Starting with glibc 2.33, the | |
64 | .BR ftime () | |
65 | function and the | |
66 | .I <sys/timeb.h> | |
67 | header have been removed. | |
68 | To support old binaries, | |
704b5ab5 | 69 | glibc continues to provide a compatibility symbol for |
37fac7c6 | 70 | applications linked against glibc 2.32 and earlier. |
53d029b3 | 71 | .SH ATTRIBUTES |
21576164 MK |
72 | For 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 |
77 | allbox; | |
c466875e | 78 | lbx lb lb |
21576164 MK |
79 | l l l. |
80 | Interface Attribute Value | |
81 | T{ | |
53d029b3 | 82 | .BR ftime () |
21576164 MK |
83 | T} Thread safety MT-Safe |
84 | .TE | |
c466875e MK |
85 | .hy |
86 | .ad | |
87 | .sp 1 | |
3113c7f3 | 88 | .SH STANDARDS |
2b2581ee | 89 | 4.2BSD, POSIX.1-2001. |
2f0526ae MK |
90 | POSIX.1-2008 removes the specification of |
91 | .BR ftime (). | |
847e0d88 | 92 | .PP |
c13182ef MK |
93 | This function is obsolete. |
94 | Don't use it. | |
95 | If the time in seconds | |
fea681da MK |
96 | suffices, |
97 | .BR time (2) | |
98 | can be used; | |
99 | .BR gettimeofday (2) | |
100 | gives microseconds; | |
0eb44391 | 101 | .BR clock_gettime (2) |
4aeb80ed MK |
102 | gives nanoseconds but is not as widely available. |
103 | .SH BUGS | |
eb4a2faa MK |
104 | Early glibc2 is buggy and returns 0 in the |
105 | .I millitm | |
106 | field; | |
fea681da | 107 | glibc 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) |