Print this page
Minor markup tweaks (Sy instead of Nm).
fix incorrect standard citations
first round of POSIX 2008 stuff
   1 '\" te
   2 .\"  Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved  Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
   3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   4 .\" http://www.opengroup.org/bookstore/.
   5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   6 .\"  This notice shall appear on any product containing this material.
   7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  10 .TH FTIME 3C "Jul 24, 2002"
  11 .SH NAME
  12 ftime \- get date and time
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 #include <sys/timeb.h>
  17 
  18 \fBint\fR \fBftime\fR(\fBstruct timeb *\fR\fItp\fR);
  19 .fi
  20 
  21 .SH DESCRIPTION
  22 .sp
  23 .LP
  24 The \fBftime()\fR function sets the \fBtime\fR and \fBmillitm\fR members of the
  25 \fBtimeb\fR structure pointed to by \fItp\fR. The structure is defined in
  26 <\fBsys/timeb.h\fR> and contains the following members:
  27 .sp
  28 .in +2
  29 .nf
  30 time_t           time;
  31 unsigned short   millitm;
  32 short            timezone;
  33 short            dstflag;
  34 .fi
  35 .in -2
  36 
  37 .sp
  38 .LP
  39 The \fBtime\fR and \fBmillitm\fR members contain the seconds and milliseconds






  40 portions, respectively, of the current time in seconds since 00:00:00 UTC
  41 (Coordinated Universal Time), January 1, 1970.
  42 .sp
  43 .LP
  44 The \fBtimezone\fR member contains the local time zone. The \fBdstflag\fR
  45 member contains a flag that, if non-zero, indicates that Daylight Saving time


  46 applies locally during the appropriate part of the year.
  47 .sp
  48 .LP
  49 The contents of the \fBtimezone\fR and \fBdstflag\fR members of \fItp\fR after
  50 a call to \fBftime()\fR are unspecified.
  51 .SH RETURN VALUES
  52 .sp
  53 .LP
  54 Upon successful completion, the \fBftime()\fR function returns \fB0\fR.
  55 Otherwise \fB\(mi1\fR is returned.
  56 .SH ERRORS
  57 .sp
  58 .LP

  59 No errors are defined.
  60 .SH USAGE
  61 .sp
  62 .LP
  63 For portability to implementations conforming to earlier versions of this
  64 document, \fBtime\fR(2) is preferred over this function.
  65 .sp
  66 .LP
  67 The millisecond value usually has a granularity greater than one due to the
  68 resolution of the system clock.  Depending on any granularity (particularly a
  69 granularity of one) renders code non-portable.
  70 .SH ATTRIBUTES
  71 .sp
  72 .LP
  73 See \fBattributes\fR(5) for descriptions of the following attributes:
  74 .sp
  75 
  76 .sp
  77 .TS
  78 box;
  79 c | c
  80 l | l .
  81 ATTRIBUTE TYPE  ATTRIBUTE VALUE
  82 _
  83 Interface Stability     Standard
  84 .TE
  85 
  86 .SH SEE ALSO
  87 .sp
  88 .LP
  89 \fBdate\fR(1), \fBtime\fR(2), \fBctime\fR(3C), \fBgettimeofday\fR(3C),
  90 \fBtimezone\fR(4), \fBattributes\fR(5), \fBstandards\fR(5)
   1 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
   2 .\"  Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved  Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
   3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   4 .\" http://www.opengroup.org/bookstore/.
   5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   6 .\"  This notice shall appear on any product containing this material.
   7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  10 .Dd "Jul 19, 2014"
  11 .Dt FTIME 3C
  12 .Os
  13 .Sh NAME
  14 .Nm ftime
  15 .Nd get date and time
  16 .Sh SYNOPSIS
  17 .In sys/timeb.h
  18 .Ft int
  19 .Fn ftime "struct timeb *tp"
  20 .Sh DESCRIPTION
  21 The
  22 .Fn ftime
  23 function sets the
  24 .Fa time
  25 and
  26 .Fa millitm
  27 members of the
  28 .Ft timeb
  29 structure pointed to by
  30 .Fa tp .
  31 The structure is defined in
  32 .In sys/timeb.h
  33 and contains the following members:
  34 .Bl -column "unsigned short" "timezone" -offset indent
  35 .It Ft time_t Ta Fa time ;
  36 .It Ft unsigned short Ta Fa millitim ;
  37 .It Ft short Ta Fa timezone ;
  38 .It Ft short Ta Fa dstflag ;
  39 .El
  40 .Lp
  41 The
  42 .Fa time
  43 and
  44 .Fa millitm
  45 members contain the seconds and milliseconds
  46 portions, respectively, of the current time in seconds since 00:00:00 UTC
  47 (Coordinated Universal Time), January 1, 1970.
  48 .Lp
  49 The
  50 .Fa timezone
  51 member contains the local time zone. The
  52 .Fa dstflag
  53 member contains a flag that, if non-zero, indicates that Daylight Saving Time
  54 applies locally during the appropriate part of the year.
  55 .Lp
  56 The contents of the
  57 .Fa timezone
  58 and
  59 .Fa dstflag
  60 members of
  61 .Fa tp
  62 after a call to
  63 .Fn ftime
  64 are unspecified.
  65 .Sh RETURN VALUES
  66 .Rv -std
  67 .Sh ERRORS
  68 No errors are defined.
  69 .Sh USAGE
  70 Portable applications should use either
  71 .Xr time 2 ,
  72 or, if sub-second precision is required,
  73 .Xr clock_gettime 3C .
  74 .Lp

  75 The millisecond value usually has a granularity greater than one due to the
  76 resolution of the system clock.  Depending on any granularity (particularly a
  77 granularity of one) renders code non-portable.
  78 .Sh INTERFACE STABILITY
  79 .Sy Obsolete Standard .
  80 .Sh MT-LEVEL
  81 .Sy Safe .
  82 .Sh SEE ALSO
  83 .Xr date 1 ,
  84 .Xr time 2 ,
  85 .Xr clock_gettime 3C ,
  86 .Xr ctime 3C ,
  87 .Xr gettimeofday 3C ,
  88 .Xr timezone 4 ,
  89 .Xr standards 5
  90 .Sh STANDARDS
  91 The
  92 .Fn ftime
  93 function was introduced in
  94 .St -xpg4.2 .
  95 It was subsequently obsoleted in
  96 .St -p1003.1-2001
  97 and removed from
  98 .St -p1003.1-2008 .