NAME
irLBolt, irNap - Unix clock routines
SYNOPSIS
#include <irapi.h>
int irLBolt ( );
int irNap (int interval);
DESCRIPTION
Function irLBolt returns the lbolt time for the system. The
lbolt time is defined as the amount of time which has passed
since the UNIX system was last booted. However, after
approximately 248 days this value will overflow to a large
negative number. The unit of time is hundredths of seconds.
Function irNap sleeps for interval hundredths of seconds.
This is a blocking sleep, therefore, unlike most other IRAPI
functions, it will not return immediately. Also, there will
be no event indicating the completion of irNap.
EVENTS
No event results from the call to either of these functions.
RETURN VALUE
irLBolt, on success, returns the elapsed time since the last
UNIX system reboot measured in hundredths of seconds. A
return value of -1 is a possibly valid return value, but is
can also indicate that an error occurred in getting the sys-
tem lbolt value.
irNap returns IRR_FAIL on error, otherwise the number of
''unslept'' hundredths of seconds are returned; 0 indicating
''sleep'' to completion, a positive value indicating interr-
uption due to a signal.
ERROR
irError is set as follows on error.
IRER_SYSERROR on system call failure (see irSysError for
additional information).
CAVEAT
Since irNap is a blocking function, it should not be used in
typical IRAPI applications.
These functions report values based on the inherent clock
granularity of the currently supported hardware platform.
This granularity is not guaranteed with future hardware
platforms.
WARNING
Applications should never assume that lbolt will always be
positive (0, -1, and any other negative value are possible
lbolt values). Applications should never assume that there
is a maximum or minimum value for lbolt. Extra caution
should be taken whenever using lbolt values due to the pos-
sibility of it going negative after a long period of time.
For example direct comparison of values returned by
irLBolt(3IRAPI) will result in errors when irLBolt(3IRAPI)
wraps around to a large negative value after approximately
248 days. The correct way to compare values returned by
irLBolt(3IRAPI) is to subtract the values first, e.g.:
time_start = irLBolt(3IRAPI);
... some time consuming work ...
time_now = irLBolt(3IRPAI);
if ( (time_now - time_start) > MAXTICKS ) {
statement1;
} else {
statement2;
}
Done this way, even if irLBolt(3IRAPI) wraps around to a
large negative value, even between when the time samples are
taken, the subtraction will correctly determine the number
of clock ticks between the start time and the current time.
The only time this will fail is when the time difference
exceeds approximately 248 days.
SEE ALSO
irTimer(3IRAPI), irTTTimer(3IRAPI), irRecogTimer(3IRAPI),
IrPARAMETERS(4IRAPI).
VERSION
This is version 11/25/02 of this man page.