2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1993 Michael Haardt
|
|
|
|
.\" (michael@moria.de)
|
|
|
|
.\" Fri Apr 2 11:32:09 MET DST 1993
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.\" Modified Sat Jul 24 14:23:14 1993 by Rik Faith (faith@cs.unc.edu)
|
|
|
|
.\" Modified Sun Oct 18 17:31:43 1998 by Andries Brouwer (aeb@cwi.nl)
|
2008-06-22 02:01:50 +00:00
|
|
|
.\" 2008-06-23, mtk, minor rewrites, added some details
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
add_key.2, keyctl.2, request_key.2, stime.2, time.2, ctime.3, difftime.3, ftime.3, getspnam.3, mq_receive.3, mq_send.3, rtime.3, sem_wait.3, string.3, timeradd.3, tzset.3, rtc.4, core.5, icmp.7, time.7, zic.8: Updated .TH timestamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-02-25 09:43:57 +00:00
|
|
|
.TH FTIME 3 2010-02-25 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
ftime \- return date and time
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B "#include <sys/timeb.h>"
|
|
|
|
.sp
|
|
|
|
.BI "int ftime(struct timeb *" tp );
|
|
|
|
.SH DESCRIPTION
|
stime.2, time.2, utimensat.2, ctime.3, difftime.3, ftime.3, getspnam.3, mq_receive.3, mq_send.3, rtime.3, sem_wait.3, strftime.3, strptime.3, timeradd.3, rtc.4, core.5, proc.5, icmp.7, time.7: Global fix: Consistently define the Epoch
All definitions of the Epoch have been refactored to the following:
1970-01-01 00:00:00 +0000 (UTC)
That form is more consistent, logical, precise, and internationally
recognizable than the other variants.
Also, some wording has been altered as well.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-17 03:53:52 +00:00
|
|
|
This function returns the current time as seconds and milliseconds
|
|
|
|
since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
|
2008-06-22 02:01:50 +00:00
|
|
|
The time is returned in
|
2004-11-03 13:51:07 +00:00
|
|
|
.IR tp ,
|
|
|
|
which is declared as follows:
|
|
|
|
.sp
|
2007-12-19 05:53:30 +00:00
|
|
|
.in +4n
|
2004-11-03 13:51:07 +00:00
|
|
|
.nf
|
|
|
|
struct timeb {
|
2007-07-09 20:43:38 +00:00
|
|
|
time_t time;
|
2007-04-05 13:29:41 +00:00
|
|
|
unsigned short millitm;
|
2007-07-09 20:43:38 +00:00
|
|
|
short timezone;
|
|
|
|
short dstflag;
|
2004-11-03 13:51:07 +00:00
|
|
|
};
|
|
|
|
.fi
|
2007-12-19 05:53:30 +00:00
|
|
|
.in
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
2007-12-18 15:37:46 +00:00
|
|
|
Here \fItime\fP is the number of seconds since the Epoch,
|
2008-06-22 02:01:50 +00:00
|
|
|
and \fImillitm\fP is the number of milliseconds since \fItime\fP
|
|
|
|
seconds since the Epoch.
|
2008-09-07 04:17:25 +00:00
|
|
|
The \fItimezone\fP field is the local timezone measured in minutes
|
2008-06-22 02:01:50 +00:00
|
|
|
of time west of Greenwich (with a negative value indicating minutes
|
|
|
|
east of Greenwich).
|
|
|
|
The \fIdstflag\fP field
|
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
|
|
|
is a flag that, if nonzero, indicates that Daylight Saving time
|
2004-11-03 13:51:07 +00:00
|
|
|
applies locally during the appropriate part of the year.
|
|
|
|
.LP
|
2008-06-22 02:01:50 +00:00
|
|
|
POSIX.1-2001 says that the contents of the \fItimezone\fP and \fIdstflag\fP
|
|
|
|
fields are unspecified; avoid relying on them.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
|
|
|
This function always returns 0.
|
2008-06-22 02:01:50 +00:00
|
|
|
(POSIX.1-2001 specifies, and some systems document, a \-1 error return.)
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH "CONFORMING TO"
|
|
|
|
4.2BSD, POSIX.1-2001.
|
2008-08-06 12:09:19 +00:00
|
|
|
POSIX.1-2008 removes the specification of
|
|
|
|
.BR ftime ().
|
2009-03-14 18:25:25 +00:00
|
|
|
|
2007-04-12 22:42:49 +00:00
|
|
|
This function is obsolete.
|
|
|
|
Don't use it.
|
|
|
|
If the time in seconds
|
2004-11-03 13:51:07 +00:00
|
|
|
suffices,
|
|
|
|
.BR time (2)
|
|
|
|
can be used;
|
|
|
|
.BR gettimeofday (2)
|
|
|
|
gives microseconds;
|
clock_nanosleep.2, getrusage.2, timerfd_create.2, clock.3, clock_getcpuclockid.3, ftime.3, pthread_create.3, pthread_getcpuclockid.3, pthread_tryjoin_np.3, sem_wait.3, time.7: Global fix: Fix xrefs to clock_*.? pages to reflect move to section 2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2009-02-07 21:10:39 +00:00
|
|
|
.BR clock_gettime (2)
|
2009-03-14 18:25:25 +00:00
|
|
|
gives nanoseconds but is not as widely available.
|
|
|
|
.SH BUGS
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
Under libc4 and libc5 the \fImillitm\fP field is meaningful.
|
|
|
|
But early glibc2 is buggy and returns 0 there;
|
|
|
|
glibc 2.1.1 is correct again.
|
2007-05-18 11:59:14 +00:00
|
|
|
.\" .SH HISTORY
|
|
|
|
.\" The
|
|
|
|
.\" .BR ftime ()
|
|
|
|
.\" function appeared in 4.2BSD.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR gettimeofday (2),
|
|
|
|
.BR time (2)
|