All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)gettimeofday.2 6.2 (Berkeley) 06/05/85
#include <sys/time.h>gettimeofday(tp, tzp) struct timeval *tp; struct timezone *tzp;
settimeofday(tp, tzp) struct timeval *tp; struct timezone *tzp;
The structures pointed to by tp and tzp are defined in <sys/time.h> as:
struct timeval { long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ }; struct timezone { int tz_minuteswest; /* of Greenwich */ 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.
If tzp is zero settimeofday does not change the current time zone. Only the super-user may set the time of day.
15 [EFAULT] An argument address referenced invalid memory.
15 [EPERM] A user other than the super-user attempted to set the time.