Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ timer_settime(3P4) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

timer_create(3P4)

timer_delete(3P4)

timer_gettime(3P4)

timer_settime(3P4)

NAME

timer_settime − POSIX 1003.4 Arm a Per-process Timer

SYNOPSIS

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

int timer_settime(timerid, flags, value, ovalue)
timer_t            timerid
int                flags
struct itimerspec  ∗value
struct itimerspec  ∗ovalue

DESCRIPTION

The timer_settime() function sets the time until the next expiration of the timer specified by timerid previously allocated by the timer_create(3P4) function.  If the specified timer was already armed when timer_settime() is called, this call resets the time until next expiration to the value specified.  If the it_value member of value is zero, the timer is disarmed.  If the flag TIMER_ABSTIME of flags is not set, timer_settime() behaves as if the time until next expiration is set equal to the interval specified by the it_value member of value.  That is, the timer will expire in it_value nanoseconds from when the call is made.  If the flag TIMER_ABSTIME of flags is set, timer_settime() the next expiration is set equal to the difference between the absolute time specified by the it_value member of value and current value of the clock associated with timerid.  That is, the timer will expire when the clock reaches the value specified by the it_value member of value.  If the specified time has already passed, the function shall succeed and the expiration notification shall be made.  The reload value of the timer is set to the value specified by the it_interval member of value.  When a timer is armed with a non-zero it_interval, a periodic timer is specified.  If the ovalue argument is non-NULL, the amount of time until the next timer expiration is returned along with the timer reload value.  If the timer was previous disarmed, a zero value is returned. 

The itimerspec structure definition is:

struct itimerspec {

struct timespecit_interval; /∗ repetitive timer period ∗/
struct timespecit_value; /∗ initial timer period ∗/

}

The timespec structure definition is:

struct timespec {

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

}

RETURN VALUE

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

[EINVAL] The timer ID specified by timerid is not a valid timer ID. 

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

[ENOSYS] The function timer_settime() is not supported by this implementation. 

FILES

/usr/lib/libposix4.a

SEE ALSO

timer_create(3P4), timer_delete(3P4), timer_gettime(3P4). 

WARNING

The interface to timer_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