Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 8

TimerSettime(), TimerSettime_r()

Set the expiration time for a timer

Synopsis:

#include <sys/neutrino.h>

int TimerSettime( timer_t id,
                  int flags,
                  const struct _itimer * itime,
                  struct _itimer * oitime );

int TimerSettime_r( timer_t id,
                    int flags,
                    const struct _itimer * itime,
                    struct _itimer * oitime );

Arguments:

id
The ID of the timer whose an expiration date you want to set, as returned by TimerCreate().
flags
The only supported flag is TIMER_ABSTIME. If specified, then nsec represents an “absolute” expiration date in nanoseconds from the Unix Epoch, 00:00:00 January 1, 1970 UTC. If the date specified has already passed, then the expiration event is delivered immediately.

If the flag isn't specified, nsec represents a “relative” expiration period that's offset from the given clock's current system time in nanoseconds.

itime
A pointer to a _itimer structure that specifies the expiration date. For detailed information, see Expiration date, ” below.
oitime
NULL, or a pointer to a _itimer structure where the function can store the interval timer period (i.e. previous amount of time left before the timer was to have expired), or zero if the timer was disarmed at the time of the call. The previous interval timer period is also stored in the interval_nsec member.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The TimerSettime() and TimerSettime_r() kernel calls set the expiration time of the timer specified by id.

These functions are identical except in the way they indicate errors. See the Returns section for details.


Note: Instead of using these kernel calls directly, consider calling timer_gettime() or timer_settime().

Expiration date

The expiration is specified by the itime argument. The _itimer structure contains at least the following members:

uint64_t nsec
The expiration time to set.
uint64_t interval_nsec
The interval reload time.

If the nsec member of itime is zero, then the timer is disarmed.

If the interval_nsec member of itime is nonzero, then it specifies a repeat rate which is added to the timer once the nsec period has expired. Subsequently, the timer is automatically rearmed, causing it to become repetitive with a period of interval_nsec.

If the timer is already armed when you call TimerSettime(), this call discards the previous setting and sets a new setting.

If the event notification specified by TimerCreate() has a sigev_code of SI_TIMER, then at most one event is queued. In this case, if an event is pending from a previous timer when the timer fires again, a timer overrun occurs. You can use the TimerInfo() kernel call to obtain the number of overruns that have occurred on this timer.


Note: Because of the nature of time measurement, the timer might actually expire after the specified time. For more information, see the Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide.

Blocking states

This call doesn't block.

Returns:

The only difference between these functions is the way they indicate errors:

TimerSettime()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
TimerSettime_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Errors:

EINVAL
The timer specified by id doesn't exist.
EFAULT
A fault occurred when the kernel tried to access itime or oitime.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

timer_gettime(), timer_settime(), TimerCreate(), TimerInfo()

Clocks, Timers, and Getting a Kick Every So Often chapter of Getting Started with QNX Neutrino

Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 265

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/timersettime.html on line 265