OS_CYCLES_TO_USEC OS_CYCLES_TO_USEC (Macro)

OS_CYCLES_TO_NSEC, OS_CYCLES_TO_USEC

Converts from CPU Count register cycles to nanoseconds/microseconds

Syntax

#include <ultra64.h>     /* ultra64.h */
u64 OS_CYCLES_TO_NSEC(OSTime cycles);
u64 OS_CYCLES_TO_USEC(OSTime cycles);

Description

The OS_CYCLES_TO_NSEC and OS_CYCLES_TO_USEC macros convert the number of cycles in the CPU's count register into a length of time (nanoseconds or microseconds).

The CPU's count register cycle is the unit of time used by the functions osGetTime and osSetTimer. Irregardless of whether the system is NTSC or PAL, this CPU count register increments at a period of 46.875 MHz, with 1 cycle equal to approximately 21.33 nanoseconds.

Note that the returned value is type u64 (unsigned long long), so you should specify "%llu" for the conversion format if the returned value is to be output by a printf function.

See Also

OS_NSEC_TO_CYCLES, osGetCount

Revision history

1999/06/15 Completely revised