time, ftime -- return time


cc . . . -lc

#include  <sys/types.h>
#include  <time.h>

time_t time (tloc) time_t *tloc;

#include  <sys/types.h>
#include  <sys/timeb.h>
#include  <time.h>

void ftime (tp) struct timeb *tp;


The time system call returns the value of time in seconds since 1970-01-01 00:00 UTC.

If tloc is nonzero, the return value is also stored in the location to which tloc points.

ftime returns the time in the timeb structure as follows:

   struct timeb {
           time_t time;           /* time, seconds since the epoch */
           unsigned short millitm;/* 1000 msec of additional accuracy */
           short timezone;        /* timezone, minutes west of GMT */
           short dstflag;         /* daylight savings */
The timezone member is a system default timezone and not the value of the TZ environment value. This structure contains the time since the epoch in seconds, up to 1000 milliseconds of a more-precise interval, the local time zone (measured in minutes of time westward from Greenwich), and a flag that, if nonzero, indicates that Daylight Savings Time applies locally during the appropriate part of the year.


Upon successful completion, time returns the value of time. Otherwise, a value of -1 is returned, and errno is set to indicate the error.

The time system call fails and its actions are undefined if tloc points to an illegal address. ftime fails if tp points to an illegal address. For either failure, errno is set to EFAULT.

See Also

ctime(S), difftime(S), mktime(S), nl_cxtime(S), stime(S), times(S)

Standards conformance

time is conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
ANSI X3.159-1989 Programming Language -- C ;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .

ftime is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003