]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ftime.3
stime.2, time.2, utimensat.2, ctime.3, difftime.3, ftime.3, getspnam.3, mq_receive...
[thirdparty/man-pages.git] / man3 / ftime.3
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" Copyright (c) 1993 Michael Haardt
4.\" (michael@moria.de)
5.\" Fri Apr 2 11:32:09 MET DST 1993
6.\"
7.\" This is free documentation; you can redistribute it and/or
8.\" modify it under the terms of the GNU General Public License as
9.\" published by the Free Software Foundation; either version 2 of
10.\" the License, or (at your option) any later version.
11.\"
12.\" The GNU General Public License's references to "object code"
13.\" and "executables" are to be interpreted as the output of any
14.\" document formatting or typesetting system, including
15.\" intermediate and printed output.
16.\"
17.\" This manual is distributed in the hope that it will be useful,
18.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.\" GNU General Public License for more details.
21.\"
22.\" You should have received a copy of the GNU General Public
23.\" License along with this manual; if not, write to the Free
24.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25.\" USA.
26.\"
27.\" Modified Sat Jul 24 14:23:14 1993 by Rik Faith (faith@cs.unc.edu)
28.\" Modified Sun Oct 18 17:31:43 1998 by Andries Brouwer (aeb@cwi.nl)
cb772f76 29.\" 2008-06-23, mtk, minor rewrites, added some details
fea681da 30.\"
4aeb80ed 31.TH FTIME 3 2009-03-15 "GNU" "Linux Programmer's Manual"
fea681da
MK
32.SH NAME
33ftime \- return date and time
34.SH SYNOPSIS
35.B "#include <sys/timeb.h>"
36.sp
37.BI "int ftime(struct timeb *" tp );
38.SH DESCRIPTION
f49c451a
MW
39This function returns the current time as seconds and milliseconds
40since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
cb772f76 41The time is returned in
fea681da
MK
42.IR tp ,
43which is declared as follows:
44.sp
a08ea57c 45.in +4n
fea681da
MK
46.nf
47struct timeb {
cab87712 48 time_t time;
7295b7ed 49 unsigned short millitm;
cab87712
MK
50 short timezone;
51 short dstflag;
fea681da
MK
52};
53.fi
a08ea57c 54.in
fea681da 55.LP
be9634cf 56Here \fItime\fP is the number of seconds since the Epoch,
cb772f76
MK
57and \fImillitm\fP is the number of milliseconds since \fItime\fP
58seconds since the Epoch.
5b0dc1ba 59The \fItimezone\fP field is the local timezone measured in minutes
cb772f76
MK
60of time west of Greenwich (with a negative value indicating minutes
61east of Greenwich).
62The \fIdstflag\fP field
c7094399 63is a flag that, if nonzero, indicates that Daylight Saving time
fea681da
MK
64applies locally during the appropriate part of the year.
65.LP
cb772f76
MK
66POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
67fields are unspecified; avoid relying on them.
fea681da
MK
68.SH "RETURN VALUE"
69This function always returns 0.
cb772f76 70(POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
2b2581ee
MK
71.SH "CONFORMING TO"
724.2BSD, POSIX.1-2001.
2f0526ae
MK
73POSIX.1-2008 removes the specification of
74.BR ftime ().
4aeb80ed 75
c13182ef
MK
76This function is obsolete.
77Don't use it.
78If the time in seconds
fea681da
MK
79suffices,
80.BR time (2)
81can be used;
82.BR gettimeofday (2)
83gives microseconds;
0eb44391 84.BR clock_gettime (2)
4aeb80ed
MK
85gives nanoseconds but is not as widely available.
86.SH BUGS
fea681da
MK
87.LP
88Under libc4 and libc5 the \fImillitm\fP field is meaningful.
89But early glibc2 is buggy and returns 0 there;
90glibc 2.1.1 is correct again.
889829be
MK
91.\" .SH HISTORY
92.\" The
93.\" .BR ftime ()
94.\" function appeared in 4.2BSD.
fea681da
MK
95.SH "SEE ALSO"
96.BR gettimeofday (2),
97.BR time (2)