OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / ftime.3
1 .\" Copyright (c) 1993 Michael Haardt
2 .\" (michael@moria.de)
3 .\" Fri Apr  2 11:32:09 MET DST 1993
4 .\"
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
10 .\"
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
15 .\"
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 .\" GNU General Public License for more details.
20 .\"
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Sat Jul 24 14:23:14 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Sun Oct 18 17:31:43 1998 by Andries Brouwer (aeb@cwi.nl)
28 .\" 2008-06-23, mtk, minor rewrites, added some details
29 .\"
30 .TH FTIME 3 2014-08-19 "GNU" "Linux Programmer's Manual"
31 .SH NAME
32 ftime \- return date and time
33 .SH SYNOPSIS
34 .B "#include <sys/timeb.h>"
35 .sp
36 .BI "int ftime(struct timeb *" tp );
37 .SH DESCRIPTION
38 This function returns the current time as seconds and milliseconds
39 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
40 The time is returned in
41 .IR tp ,
42 which is declared as follows:
43 .sp
44 .in +4n
45 .nf
46 struct timeb {
47     time_t         time;
48     unsigned short millitm;
49     short          timezone;
50     short          dstflag;
51 };
52 .fi
53 .in
54 .LP
55 Here \fItime\fP is the number of seconds since the Epoch,
56 and \fImillitm\fP is the number of milliseconds since \fItime\fP
57 seconds since the Epoch.
58 The \fItimezone\fP field is the local timezone measured in minutes
59 of time west of Greenwich (with a negative value indicating minutes
60 east of Greenwich).
61 The \fIdstflag\fP field
62 is a flag that, if nonzero, indicates that Daylight Saving time
63 applies locally during the appropriate part of the year.
64 .LP
65 POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
66 fields are unspecified; 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 .SS Multithreading (see pthreads(7))
72 The
73 .BR ftime ()
74 function is thread-safe.
75 .SH CONFORMING TO
76 4.2BSD, POSIX.1-2001.
77 POSIX.1-2008 removes the specification of
78 .BR ftime ().
79
80 This function is obsolete.
81 Don't use it.
82 If the time in seconds
83 suffices,
84 .BR time (2)
85 can be used;
86 .BR gettimeofday (2)
87 gives microseconds;
88 .BR clock_gettime (2)
89 gives nanoseconds but is not as widely available.
90 .SH BUGS
91 .LP
92 Early glibc2 is buggy and returns 0 in the
93 .I millitm
94 field;
95 glibc 2.1.1 is correct again.
96 .\" .SH HISTORY
97 .\" The
98 .\" .BR ftime ()
99 .\" function appeared in 4.2BSD.
100 .SH SEE ALSO
101 .BR gettimeofday (2),
102 .BR time (2)
103 .SH COLOPHON
104 This page is part of release 3.79 of the Linux
105 .I man-pages
106 project.
107 A description of the project,
108 information about reporting bugs,
109 and the latest version of this page,
110 can be found at
111 \%http://www.kernel.org/doc/man\-pages/.