settimeofday(2) SDK R4.11 settimeofday(2)
NAME
settimeofday - set date and time
SYNOPSIS
#include <sys/time.h>
int settimeofday (timevalue, timezone)
struct timeval * timevalue;
struct timezone * timezone;
where:
timevalue Address of an initialized structure giving the new
current time
timezone NULL or address of an initialized structure giving the
new time zone
DESCRIPTION
Settimeofday sets the system's notion of the current Greenwich time
and the current time zone to the values contained in the structures
at the locations specified by timevalue and timezone.
When the time is successfully changed, a log of the change is sent to
the error logger device.
Two versions of settimeofday are provided, to accommodate the
differences in the System V and BSD implementations. The BSD version
of settimeofday is selected unconditionally for 88K COFF-based
software development environments (see sde(5)), and for other
environments when BSD features are visible and either (1) the
BSDTIMEOFDAYFLAVOR macro is defined, or (2) System V features are
not visible. The System V version is selected otherwise. Note that
DG/UX revisions prior to R4.10 provided only the BSD version.
Both versions expect two arguments to be provided. For the BSD
version, both arguments are meaningful (as was true in all versions
of DG/UX prior to R4.10). For the System V version, the second
argument is treated as NULL and should be coded as such.
If timezone is NULL, the current time zone is not changed.
The interpretation of the time value and time zone structures is
discussed in gettimeofday(2).
Although not enforced, it is unusual if the time zone correction,
timezone.tzminuteswest, is not divisible by 60 minutes.
Setting the system clock may interfere with other timing functions.
ACCESS CONTROL
The calling process must have appropriate privilege to successfully
execute this system call. For systems supporting the DG/UX
Capability Option, appropriate privilege is defined as having one or
more specific capabilities enabled in the effective capability set of
the calling process. See capdefaults(5) for the default capability
for this system call.
On systems without the DG/UX Capability Option, appropriate privilege
means that the process has an effective UID of root. See the
appropriateprivilege(5) man page for more information.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EFAULT An argument address referenced invalid memory.
EPERM Permission to set the time is denied to the calling
process.
SEE ALSO
date(1), gettimeofday(2), ctime(3C), sde(5),
appropriateprivilege(5).
capdefaults(5).
Licensed material--property of copyright holder(s)