osSetTimer.3p 1.44 KB
.TH osSetTimer 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osSetTimer, osStopTimer \- start, stop an interval/countdown timer
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
int osSetTimer(OSTimer \(**timer, OSTime countdown, OSTime interval,
	       OSMesgQueue \(**mq, OSMesg msg);
.sp .8v
void osStopTimer(OSTimer \(**timer);
.Op
\f1
.fi
.SH DESCRIPTION
The
.I osSetTimer
call sets the value for the  timer specified by
.I timer.
This call supports both countdown timers and interval timers.
If
.I countdown
is non-zero,
it indicates the time to the next timer expiration.
If
.I interval
is non-zero,
it specifies a value to be used in reloading the timer when
the timer expires.
The message 
.I msg 
is copied to the end of the given message queue 
.I mq
when the timer expires. 
.I osSetTimer
always returns 0.
.sp
The
.I osStopTimer
call stops the specified interval timer.
There is not need to call 
.I osStopTimer
if only the countdown timer is enabled in the
.I osSetTimer
call.
.sp
Both 
.I countdown
and
.I interval
are expressed in CPU Count register cycles.
This counter increments at 46.875 Mhz and each counter
tick represents approximately 21.33 nanoseconds.
See
.IR OS_CYCLES_TO_NSEC (3P)
for useful macros for converting to and from counter cycle time and
nanoseconds or microseconds.
.sp
Note, to avoid a reduction in overall system performance, time values 
should not be set to less than 50 micro seconds. 
.SH "SEE ALSO"
.IR osGetTime (3P)