Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ drv_hztouse(D3DK) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

drv_hztousec(D3DK)  —  

.IX \f4drv_hztousec\fP(D3DK)

NAME

drv_hztousec − convert clock ticks to microseconds

SYNOPSIS

#include <sys/types.h>
#include <sys/ddi.h>
clock_t drv_hztousec(clock_t ticks);

ARGUMENTS

ticksThe number of clock ticks to convert to equivalent microseconds. 

DESCRIPTION

drv_hztousec converts the length of time expressed by ticks, which is in units of clock ticks, into units of microseconds. 

Several functions either take time values expressed in clock ticks as arguments [itimeout(D3DK), delay(D3DK)] or return time values expressed in clock ticks [drv_getparm(D3DK)].  The length of a clock tick can vary across different implementations, and therefore drivers should not include any hard-coded assumptions about the length of a tick.  drv_hztousec and the complementary function drv_usectohz(D3DK) can be used, as necessary, to convert between clock ticks and microseconds. 

RETURN VALUE

The number of microseconds equivalent to the ticks argument.  No error value is returned.  If the microsecond equivalent to ticks is too large to be represented as a clock_t, then the maximum clock_t value will be returned. 

LEVEL

Base or Interrupt. 

NOTES

Does not sleep. 

Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function. 

The time value returned by drv_getparm with an LBOLT argument will frequently be too large to represent in microseconds as a clock_t.  When using drv_getparm together with drv_hztousec to time operations, drivers can help avoid overflow by converting the difference between return values from successive calls to drv_getparm instead of trying to convert the return values themselves. 

SEE ALSO

delay(D3DK), drv_getparm(D3DK), drv_usectohz(D3DK), dtimeout(D3DK), itimeout(D3DK)

DDI/DKI

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026