drv_hztousec(9F)
NAME
drv_hztousec − convert clock ticks to microseconds
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
clock_t drv_hztousec(clock_t hertz);
ARGUMENTS
hertz The length of time (in HZ) to convert to its microsecond equivalent.
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
DESCRIPTION
drv_hztousec() converts into microseconds the time expressed by hertz, which is in units of time based on the value of HZ, the kernel parameter defined in <sys/param.h>.
The kernel variable lbolt, which is readable through drv_getparm(9F), is the length of time the system has been up since boot and is expressed in HZ. Drivers often use the value of lbolt before and after an I/O request to measure the amount of time it took the device to process the request. drv_hztousec() can be used by the driver to convert the reading from HZ, which could vary between system implementations, to a known unit of time.
RETURN VALUES
The number of microseconds equivalent to the hertz argument. No error value is returned. If the microsecond equivalent to hertz is too large to be represented as a clock_t , then the maximum clock_t value will be returned.
CONTEXT
drv_hztousec() can be called from user or interrupt context.
SEE ALSO
drv_getparm(9F), drv_usectohz(9F), drv_usecwait(9F)
SunOS 5.1 — Last change: 17 Sept 1992