1FTIME(3)                   Linux Programmer's Manual                  FTIME(3)
2
3
4

NAME

6       ftime - return date and time
7

SYNOPSIS

9       #include <sys/timeb.h>
10
11       int ftime(struct timeb *tp);
12

DESCRIPTION

14       NOTE: This function is deprecated, and will be removed in a future ver‐
15       sion of the GNU C library.  Use clock_gettime(2) instead.
16
17       This function returns the current  time  as  seconds  and  milliseconds
18       since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).  The time is returned
19       in tp, which is declared as follows:
20
21           struct timeb {
22               time_t         time;
23               unsigned short millitm;
24               short          timezone;
25               short          dstflag;
26           };
27
28       Here time is the number of seconds since the Epoch, and millitm is  the
29       number  of  milliseconds since time seconds since the Epoch.  The time‐
30       zone field is the local timezone measured in minutes of  time  west  of
31       Greenwich (with a negative value indicating minutes east of Greenwich).
32       The dstflag field is a flag that, if nonzero, indicates  that  Daylight
33       Saving time applies locally during the appropriate part of the year.
34
35       POSIX.1-2001  says that the contents of the timezone and dstflag fields
36       are unspecified; avoid relying on them.
37

RETURN VALUE

39       This function always returns 0.  (POSIX.1-2001 specifies, and some sys‐
40       tems document, a -1 error return.)
41

ATTRIBUTES

43       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
44       tributes(7).
45
46       ┌──────────┬───────────────┬─────────┐
47Interface Attribute     Value   
48       ├──────────┼───────────────┼─────────┤
49ftime()   │ Thread safety │ MT-Safe │
50       └──────────┴───────────────┴─────────┘

CONFORMING TO

52       4.2BSD,  POSIX.1-2001.   POSIX.1-2008  removes  the  specification   of
53       ftime().
54
55       This  function is obsolete.  Don't use it.  If the time in seconds suf‐
56       fices,  time(2)  can  be  used;  gettimeofday(2)  gives   microseconds;
57       clock_gettime(2) gives nanoseconds but is not as widely available.
58

BUGS

60       Early  glibc2  is buggy and returns 0 in the millitm field; glibc 2.1.1
61       is correct again.
62

SEE ALSO

64       gettimeofday(2), time(2)
65

COLOPHON

67       This page is part of release 5.10 of the Linux  man-pages  project.   A
68       description  of  the project, information about reporting bugs, and the
69       latest    version    of    this    page,    can     be     found     at
70       https://www.kernel.org/doc/man-pages/.
71
72
73
74GNU                               2020-02-09                          FTIME(3)
Impressum