#include <time.h> time_t time(time_t *timep);
time
returns the number of seconds from the start of an
implementation-defined era. If the timep
pointer is not NULL
,
this value is also stored in the storage addressed by timep
. The type
of time
and of the data referenced by its argument is time_t
,
declared in the header file <time.h>
. This is a numeric type
(implemented on the IBM 370 system as double
).
time
returns the approximate number of seconds since the start of the
epoch. The 1970 default epoch starts at midnight GMT, Jan. 1, 1970, as
required by the POSIX.2 standard. See Timing Functions for information
on defining a different epoch.
(time_t)-1
is returned if the time cannot be determined.
time_t
as double. Because most C implementations
define time_t
as a long integer, some applications assume this equivalence.
Such applications will require modifications for use with SAS/C.
time
returns the contents of the 370 time-of-day clock after conversion
to time_t
format and adjustment for the epoch.
#include <time.h> time_t before, after; main() { time(&before); /* Get time before computation. */ compute(); time(&after); /* Get time after computation. */ printf("Elapsed time for computation = %10.4f secondsn", difftime(after, before)); }
difftime
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.