MICROTIME(9)

NAME
microtime, getmicrotime, nanotime, getnanotime - get the current time

SYNOPSIS
#include <sys/time.h>
void
microtime(struct timeval *tv);
void
getmicrotime(struct timeval *tv);
void
nanotime(struct timespec *ts);
void
getnanotime(struct timespec *tsp);

DESCRIPTION
The microtime() and getmicrotime() functions stores the system time as a struct timeval at the address specified by tv. The nanotime() and getnanotime() functions perform the same utility, but record the time as a struct timespec instead.

Microtime() and nanotime() always query the timecounter to return the current time as precisely as possible. Whereas getmicrotime() and getnanotime() functions are abstractions which return a less precise, but faster to obtain, time. The getmicrouptime() and getnanouptime() functions will return a time which is up to 1/HZ previous to the call.

The intent of the getmicrotime() and getnanotime() functions is to enforce the user's preference for timer accuracy versus execution time.

SEE ALSO
getmicrouptime(9), getnanouptime(9), microuptime(9), nanouptime(9), tvtohz(9)

HISTORY
The microtime and nanotime functions first appeared in FreeBSD 3.0 but existed in other incarnations since 4.4BSD

AUTHORS
This manual page was written by Kelly Yancey <kbyanc@posi.net>.