1FTIME(3) Linux Programmer's Manual FTIME(3)
2
3
4
6 ftime - return date and time
7
9 #include <sys/timeb.h>
10
11 int ftime(struct timeb *tp);
12
14 This function returns the current time as seconds and milliseconds
15 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). The time is returned
16 in tp, which is declared as follows:
17
18 struct timeb {
19 time_t time;
20 unsigned short millitm;
21 short timezone;
22 short dstflag;
23 };
24
25 Here time is the number of seconds since the Epoch, and millitm is the
26 number of milliseconds since time seconds since the Epoch. The time‐
27 zone field is the local timezone measured in minutes of time west of
28 Greenwich (with a negative value indicating minutes east of Greenwich).
29 The dstflag field is a flag that, if nonzero, indicates that Daylight
30 Saving time applies locally during the appropriate part of the year.
31
32 POSIX.1-2001 says that the contents of the timezone and dstflag fields
33 are unspecified; avoid relying on them.
34
36 This function always returns 0. (POSIX.1-2001 specifies, and some sys‐
37 tems document, a -1 error return.)
38
40 For an explanation of the terms used in this section, see
41 attributes(7).
42
43 ┌──────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├──────────┼───────────────┼─────────┤
46 │ftime() │ Thread safety │ MT-Safe │
47 └──────────┴───────────────┴─────────┘
49 4.2BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of
50 ftime().
51
52 This function is obsolete. Don't use it. If the time in seconds suf‐
53 fices, time(2) can be used; gettimeofday(2) gives microseconds;
54 clock_gettime(2) gives nanoseconds but is not as widely available.
55
57 Early glibc2 is buggy and returns 0 in the millitm field; glibc 2.1.1
58 is correct again.
59
61 gettimeofday(2), time(2)
62
64 This page is part of release 4.16 of the Linux man-pages project. A
65 description of the project, information about reporting bugs, and the
66 latest version of this page, can be found at
67 https://www.kernel.org/doc/man-pages/.
68
69
70
71GNU 2017-09-15 FTIME(3)