TIME_SECOND(9) | Kernel Developer's Manual | TIME_SECOND(9) |
time_second
, time_uptime
—
#include <sys/time.h>
extern time_t time_second;
extern time_t time_uptime;
The time_uptime variable is a monotonically increasing system clock. It is set at boot, and is updated periodically. (It is not updated by settimeofday(2).)
All of these variables contain times expressed in seconds since midnight (0 hour), January 1, 1970, UTC.
The bintime(9), getbintime(9), microtime(9), getmicrotime(9), nanotime(9), and getnanotime(9) functions can be used to get the current time more accurately and in an atomic manner.
Similarly, the binuptime(9), getbinuptime(9), microuptime(9), getmicrouptime(9), nanouptime(9), and getnanouptime(9) functions can be used to get the time elapsed since boot more accurately and in an atomic manner.
April 17, 2020 | NetBSD 10.1 |