TIME(2)TIME(2)
NAME
time, nsec, uptime, fastticks – time in seconds and nanoseconds
SYNOPSIS
#include <u.h>
#include <libc.h>
long time(long *tp)
vlong nsec(void)
vlong uptime(void)
uvlong fastticks(uvlong *hz)
DESCRIPTION
Both
time
and
nsec
return the time since the epoch 00:00:00 GMT, Jan. 1, 1970.
The return value of the former is in seconds and the latter in nanoseconds.
For
time,
if
tp
is not zero then
*tp
is also set to the answer.
Uptime
returns monotonically increasing nanoseconds since boot.
Fastticks
returns clock cycles from the highest precision clock in the system.
If
hz
is not nil then
*hz
is set to the cycle frequency of the high precision clock.
These functions work by reading
/dev/bintime.
SOURCE
/sys/src/libc/9sys/time.c
/sys/src/libc/9sys/nsec.c
SEE
cputime(2),
cons(3)
DIAGNOSTICS
Sets
errstr.