Debian Codegraph @

upstream/debian-unstable/man3/ftime.3

raw
1 '\" t
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\"
6 .TH ftime 3 2025-10-29 "Linux man-pages 6.18"
7 .SH NAME
8 ftime \- return date and time
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ,\~ \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B "#include <sys/timeb.h>"
15 .P
16 .BI "[[deprecated]] int ftime(struct timeb *" tp );
17 .fi
18 .SH DESCRIPTION
19 .BR NOTE :
20 This function is no longer provided by the GNU C library.
21 Use
22 .BR clock_gettime (2)
23 instead.
24 .P
25 This function returns the current time as seconds and milliseconds
26 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
27 The time is returned in
28 .IR tp ,
29 which is declared as follows:
30 .P
31 .in +4n
32 .EX
33 struct timeb {
34 time_t time;
35 unsigned short millitm;
36 short timezone;
37 short dstflag;
38 };
39 .EE
40 .in
41 .P
42 Here
43 .I time
44 is the number of seconds since the Epoch,
45 and
46 .I millitm
47 is the number of milliseconds since
48 .I time
49 seconds since the Epoch.
50 The
51 .I timezone
52 field is the local timezone measured in minutes
53 of time west of Greenwich (with a negative value indicating minutes
54 east of Greenwich).
55 The
56 .I dstflag
57 field
58 is a flag that, if nonzero, indicates that Daylight Saving time
59 applies locally during the appropriate part of the year.
60 .P
61 POSIX.1-2001 says that the contents of the
62 .I timezone
63 and
64 .I dstflag
65 fields are unspecified;
66 avoid relying on them.
67 .SH RETURN VALUE
68 This function always returns 0.
69 (POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
70 .SH ATTRIBUTES
71 For an explanation of the terms used in this section, see
72 .BR attributes (7).
73 .TS
74 allbox;
75 lbx lb lb
76 l l l.
77 Interface Attribute Value
78 T{
79 .na
80 .nh
81 .BR ftime ()
82 T} Thread safety MT-Safe
83 .TE
84 .SH STANDARDS
85 None.
86 .SH HISTORY
87 4.2BSD.
88 Marked as LEGACY in POSIX.1-2001;
89 removed in POSIX.1-2008.
90 Removed in glibc 2.33.
91 .P
92 This function is obsolete.
93 Don't use it.
94 If the time in seconds
95 suffices,
96 .BR time (2)
97 can be used;
98 .BR gettimeofday (2)
99 gives microseconds;
100 .BR clock_gettime (2)
101 gives nanoseconds but is not as widely available.
102 .SH BUGS
103 Early glibc2 is buggy and returns 0 in the
104 .I millitm
105 field;
106 glibc 2.1.1 is correct again.
107 .\" .SH HISTORY
108 .\" The
109 .\" .BR ftime ()
110 .\" function appeared in 4.2BSD.
111 .SH SEE ALSO
112 .BR gettimeofday (2),
113 .BR time (2)