GETTIMEOFDAY(2,L) AIX Technical Reference GETTIMEOFDAY(2,L)
-------------------------------------------------------------------------------
gettimeofday, settimeofday, ftime
PURPOSE
Obtains current time.
LIBRARY
Standard C Library (libc.a)
SYNTAX
#include <sys/time.h>
int gettimeofday (tp, tzp)
struct timeval *tp;
struct timezone *tzp;
int settimeofday (tp, tzp)
struct timeval *tp;
struct timezone *tzp;
int ftime (tp)
struct timeb *tp;
DESCRIPTION
The gettimeofday system call gets the current Greenwich time and the current
time zone. The settimeofday system call sets the time and the time zone. The
time is expressed in seconds from 00:00:00 GMT January 1, 1970. If tzp equals
0, the time zone is neither returned nor set.
The tp parameter points to a timeval structure, defined in the file sys/time.h.
This structure contains the following members:
long tv_sec; /* Seconds since Jan. 1, 1970 */
long tv_usec; /* Microseconds to add to seconds */
The tzp parameter points to a timezone structure, defined in the sys/time.h
file. This structure contains the following members:
int tz_minuteswest; /* Time west of Greenwich in minutes */
int tz_dsttime; /* Type of DST correction to apply */
The timezone structure indicates the local time zone (measured in minutes of
time westward from Greenwich), and a flag that, if nonzero, indicates that
daylight saving time applies locally during the appropriate part of the year.
Processed November 7, 1990 GETTIMEOFDAY(2,L) 1
GETTIMEOFDAY(2,L) AIX Technical Reference GETTIMEOFDAY(2,L)
The tp parameter returns a pointer to a structure which contains the time since
the epoch in seconds, up to 1000 milliseconds of more precise interval, the
local time zone (measured in minutes westward from Greenwich), and a flag that,
if nonzero, indicates that Daylight Saving time applies locally during the
appropriate part of the year.
Only the superuser may set the time of day or time zone.
COMPATIBILITY NOTE
The ftime subroutine is included for compatibility with older BSD programs.
Its function has been made obsolete by gettimeofday. It is used by compiling
with Berkeley Compatibility Library (libbsd.a).
RETURN VALUE
If the call succeeds, a value of 0 is returned. If an error occurs, a value of
-1 is returned, and an error code is placed in the global variable errno.
ERROR CONDITIONS
The subroutines fail if one or more of the following are true:
EFAULT The tz or tzp parameter is not in a writable part of the user address
space.
EPERM A user other than the superuser attempted to set the time.
RELATED INFORMATION
In this book: "ctime, localtime, gmtime, asctime, tzset" and "time."
The date command in AIX Operating System Commands Reference.
The discussion of timed in AIX TCP/IP User's Guide.
Processed November 7, 1990 GETTIMEOFDAY(2,L) 2