'\" te .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .TH drv_hztousec 9F "4 Sep 2009" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME drv_hztousec \- convert clock ticks to microseconds .SH SYNOPSIS .LP .nf #include #include \fBclock_t\fR \fBdrv_hztousec\fR(\fBclock_t\fR \fIhertz\fR); .fi .SH INTERFACE LEVEL .sp .LP Architecture independent level 1 (DDI/DKI). .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIhertz\fR\fR .ad .RS 9n .rt The number of clock ticks to convert. .RE .SH DESCRIPTION .sp .LP The \fBdrv_hztousec()\fR function converts into microseconds the time expressed by \fIhertz\fR, which is in system clock ticks. .sp .LP The length of time the system has been up since boot can be retrieved by calling \fBddi_get_lbolt\fR(9F), which will return a value of type clock_t containing the number of clock ticks since boot. Drivers often use the value of \fBlbolt\fR before and after an \fBI/O\fR request to measure the amount of time it took the device to process the request. The \fBdrv_hztousec()\fR function can be used by the driver to convert the reading from clock ticks to a known unit of time. .SH RETURN VALUES .sp .LP The number of microseconds equivalent to the \fIhertz\fR parameter. No error value is returned. If the microsecond equivalent to \fIhertz\fR is too large to be represented as a \fBclock_t\fR, then the maximum \fBclock_t\fR value will be returned. .SH CONTEXT .sp .LP The \fBdrv_hztousec()\fR function can be called from user, interrupt, or kernel context. .SH SEE ALSO .sp .LP \fBddi_get_lbolt\fR(9F), \fBdrv_usectohz\fR(9F), \fBdrv_usecwait\fR(9F) .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR