1FTIME(P) POSIX Programmer's Manual FTIME(P)
2
3
4
6 ftime - get date and time (LEGACY)
7
9 #include <sys/timeb.h>
10
11 int ftime(struct timeb *tp);
12
13
15 The ftime() function shall set the time and millitm members of the
16 timeb structure pointed to by tp to contain the seconds and millisec‐
17 onds portions, respectively, of the current time in seconds since the
18 Epoch. The contents of the timezone and dstflag members of tp after a
19 call to ftime() are unspecified.
20
21 The system clock need not have millisecond granularity. Depending on
22 any granularity (particularly a granularity of one) renders code non-
23 portable.
24
26 Upon successful completion, the ftime() function shall return 0; other‐
27 wise, -1 shall be returned.
28
30 No errors are defined.
31
32 The following sections are informative.
33
35 Getting the Current Time and Date
36 The following example shows how to get the current system time values
37 using the ftime() function. The timeb structure pointed to by tp is
38 filled with the current system time values for time and millitm.
39
40
41 #include <sys/timeb.h>
42
43
44 struct timeb tp;
45 int status;
46 ...
47 status = ftime(&tp);
48
50 For applications portability, the time() function should be used to
51 determine the current time instead of ftime(). Realtime applications
52 should use clock_gettime() to determine the current time instead of
53 ftime().
54
56 None.
57
59 This function may be withdrawn in a future version.
60
62 clock_getres() , ctime() , gettimeofday() , time() , the Base Defini‐
63 tions volume of IEEE Std 1003.1-2001, <sys/timeb.h>
64
66 Portions of this text are reprinted and reproduced in electronic form
67 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
68 -- Portable Operating System Interface (POSIX), The Open Group Base
69 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
70 Electrical and Electronics Engineers, Inc and The Open Group. In the
71 event of any discrepancy between this version and the original IEEE and
72 The Open Group Standard, the original IEEE and The Open Group Standard
73 is the referee document. The original Standard can be obtained online
74 at http://www.opengroup.org/unix/online.html .
75
76
77
78IEEE/The Open Group 2003 FTIME(P)