nasd_timespec_t
.
This is a structure with two 32-bit fields, representing seconds and
nanoseconds.
nasd_gettime()
, which takes as
its sole argument a pointer to a nasd_timespec_t
. This function
assigns to that timespec the current time since the epoch of
midnight January 1, 1970 Greenwich Mean Time (GMT). Calls to nasd_gettime()
always return unique timestamps.
nasd_timespec_t
structures<nasd/nasd_general.h>
.
These may prove useful in simplifying code that deals with nasd_timespec_t
structures. They are:
Macro | Meaning |
---|---|
NASD_NSEC_PER_SEC
| The number of nanoseconds in a second |
NASD_TIMESPEC_VALID(ts)
| Evaluates nonzero if and only if ts is valid.
The seconds field must be non-negative, and the nanosecond field
must be non-negative and less than NASD_NSEC_PER_SEC .
|
NASD_TIMESPEC_VALID_NZ(ts)
| Evaluates nonzero if the timespec is valid (NASD_TIMESPEC_VALID(ts) ) and is non-zero
|
NASD_TIMESPEC_EQ(ts1, ts2)
| ts1 == ts2
|
NASD_TIMESPEC_GT(ts1, ts2)
| ts1 > ts2
|
NASD_TIMESPEC_LT(ts1, ts2)
| ts1 < ts2
|
NASD_TIMESPEC_GE(ts1, ts2)
| ts1 >= ts2
|
NASD_TIMESPEC_LE(ts1, ts2)
| ts1 <= ts2
|
NASD_TIMESPEC_ADD(result, addend)
| result += addend
|
NASD_TIMESPEC_SUB(result, subtrahend)
| result -= subtrahend
|
NASD_TIMESPEC_ZERO(ts)
| ts := 0
|
NASD_TIMESPEC_EQ_ZERO(ts)
| ts == 0
|
Some platforms provide facilities for determining the amount of
time the processor has spent idle. On these platforms,
NASD_IDLE_SUPPORT
will be defined nonzero. On
platforms which lack this support, NASD_IDLE_SUPPORT
will be zero. To determine this idle time, call
The following code fragment illustrates the use of several of the
interfaces described herein.
![]() | ![]() | ![]() |
---|---|---|
Freelists | Timing | NASD Programmer's Documentation |