Reads the current time into a time structure.
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/time.h>
void curtime ( timestruct)
struct timestruc_t *timestruct;
Item | Description |
---|---|
timestruct | Points to a timestruc_t time structure defined in the /usr/include/sys/time.h file. The curtime kernel service updates the fields in this structure with the current time. |
The curtime kernel service reads the current time into a time structure defined in the /usr/include/sys/time.h file. This service updates the tv_sec and tv_nsec fields in the time structure, pointed to by the timestruct parameter, from the hardware real-time clock. The kernel also maintains and updates a memory-mapped time tod structure. This structure is updated with each clock tick.
The kernel also maintains two other in-memory time values: the lbolt and time values. The three in-memory time values that the kernel maintains (the tod, lbolt, and time values) are available to kernel extensions. The lbolt in-memory time value is the number of timer ticks that have occurred since the system was booted. This value is updated once per timer tick. The time in-memory time value is the number of seconds since Epoch. The kernel updates the value once per second.
The curtime kernel service does not page-fault if a pinned stack and input time structure are used. Also, accessing the lbolt, time, and tod in-memory time values does not cause a page fault since they are in pinned memory.
The curtime kernel service can be called from either the process or interrupt environment.
The tod, time, and lbolt memory-mapped time values can also be read from the process or interrupt handler environment. The timestruct parameter and stack must be pinned when the curtime service is called in an interrupt handler environment.
The curtime kernel service has no return values.