osGetTime osGetTime (function)

osGetTime, osSetTime

Gets/sets the real time counter value

Syntax

#include <ultra64.h>     /* ultra64.h
OSTime osGetTime(void);
void osSetTime(OSTime time);

Description

Calling the osGetTime function returns the time since the last cold reset, expressed in units of CPU count register cycles. Regardless of whether the system is NTSC or PAL, this counter increments at 46.875 MHz, with 1 cycle equal to approximately 21.33 nanoseconds. When the counter reaches its maximum value, it returns to zero and continues to increment.
(Since the real time counter has a length of 64 bits, unless the counter value is changed by calling osSetTime it will take more than 10,000 years for the counter to reach its maximum value and return to zero.)

The osSetTime function is used to set the value of the real time counter.

See OS_CYCLES_TO_NSEC and related macros for ways of converting between the counter and time in nanoseconds and microseconds.

Note that the OSTime type is defined as u64 (unsigned long long), so you should specify "%llu" for the conversion format if you are going to output this type of numerical value with a printf function.

Note

Since the VI Manager performs timer management, you must activate the VI Manager with osCreateViManager before using this function.

See Also

osGetCount, osLogEvent, osSetTimer, and osTvType

Revision History

1999/06/15 Completely rewritten