1ftime(3) Library Functions Manual ftime(3)
2
3
4
6 ftime - return date and time
7
9 Standard C library (libc, -lc)
10
12 #include <sys/timeb.h>
13
14 int ftime(struct timeb *tp);
15
17 NOTE: This function is no longer provided by the GNU C library. Use
18 clock_gettime(2) instead.
19
20 This function returns the current time as seconds and milliseconds
21 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). The time is returned
22 in tp, which is declared as follows:
23
24 struct timeb {
25 time_t time;
26 unsigned short millitm;
27 short timezone;
28 short dstflag;
29 };
30
31 Here time is the number of seconds since the Epoch, and millitm is the
32 number of milliseconds since time seconds since the Epoch. The time‐
33 zone field is the local timezone measured in minutes of time west of
34 Greenwich (with a negative value indicating minutes east of Greenwich).
35 The dstflag field is a flag that, if nonzero, indicates that Daylight
36 Saving time applies locally during the appropriate part of the year.
37
38 POSIX.1-2001 says that the contents of the timezone and dstflag fields
39 are unspecified; avoid relying on them.
40
42 This function always returns 0. (POSIX.1-2001 specifies, and some sys‐
43 tems document, a -1 error return.)
44
46 For an explanation of the terms used in this section, see at‐
47 tributes(7).
48
49 ┌────────────────────────────────────────────┬───────────────┬─────────┐
50 │Interface │ Attribute │ Value │
51 ├────────────────────────────────────────────┼───────────────┼─────────┤
52 │ftime() │ Thread safety │ MT-Safe │
53 └────────────────────────────────────────────┴───────────────┴─────────┘
54
56 None.
57
59 Removed in glibc 2.33. 4.2BSD, POSIX.1-2001. Removed in POSIX.1-2008.
60
61 This function is obsolete. Don't use it. If the time in seconds
62 suffices, time(2) can be used; gettimeofday(2) gives microseconds;
63 clock_gettime(2) gives nanoseconds but is not as widely available.
64
66 Early glibc2 is buggy and returns 0 in the millitm field; glibc 2.1.1
67 is correct again.
68
70 gettimeofday(2), time(2)
71
72
73
74Linux man-pages 6.05 2023-07-20 ftime(3)