Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ clock_settime(3P4) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

clock_gettime(3P4)

clock_getres(3P4)

clock_settime(3P4)

NAME

clock_settime − set value of clock

SYNOPSIS

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

int clock_settime(clock_id, tp)
int              clock_id
struct timespec  ∗tp

DESCRIPTION

The clock_settime function sets the specified POSIX.4 clock clock_id to the value specified by tp.  The only valid POSIX.4 clock ID is CLOCK_REALTIME. The values specified by tp represent the amount of time (in seconds and nanoseconds) since the Epoch.  The Epoch is defined as (Jan 1 00:00:00 1970, Coordinated Universal Time). 

Note that changing the time of CLOCK_REALTIME can affect the behavior of utilities and performance monitoring tools.  It is recommended that the clock time be changed only at boot time via a program in the /etc/rc script.  See the "CX/UX Programmer’s Guide" for more details. 

The timespec structure definition is:

struct timespec {

time_t  tv_sec; /∗ seconds ∗/
long    tv_nsec; /∗ nanoseconds ∗/

}

RETURN VALUE

Upon successful completion, the clock_settime function returns a zero.  If any of the following conditions occur, the clock_settime function shall return -1 and set errno to the corresponding value:

[EINVAL] The clock_id argument does not specify a known clock. 

[EINVAL] The tp argument is outside the range for the given clock type. 

[EINVAL] The tp argument specified a nanosecond value less than zero or greater than or equal to 1000 million. 

[EPERM] The requesting process does not have the appropriate access to set the specified clock. 

FILES

/usr/lib/libposix4.a

SEE ALSO

clock_gettime(3P4), clock_getres(3P4). 

WARNING

The interface to clock_settime is based on IEEE Draft Standard P1003.4/D12.  This is an unapproved draft, subject to change.  Use of information contained in this unapproved draft is at your own risk.  This interface will change to reflect any changes made by future drafts of POSIX 1003.4. 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026