home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
datafiles
/
text
/
c_manual
/
amiga
/
appendices
/
functionsandlibraries
/
timerlibrary.doc
< prev
next >
Wrap
Text File
|
1995-02-27
|
3KB
|
91 lines
6 TIMER LIBRARY
6.1 OPEN THE TIMER LIBRARY
Before you may use the functions listed in this file you have
to get access to the Timer Library. This library is only used
together with the Timer Device and is therefore not opened as
other normal libraries. Instead you only have to declare and
initialize a global device pointer called "TimerDevice". This
global pointer should be given the current address of the timer
device. This address can be found in the "io_Device" field of
the request block. (You must of course first open the timer
device before you can find the address.)
/* Declare a pointer to the Timer Device: */
struct Device *TimerBase;
/* ... Create request blocks, open timer device etc ... */
/* Get the global pointer to the timer device: */
TimerBase = timer_req->tr_node.io_Device;
/* ... */
/* Since you have not opened anything you */
/* do not have to close anything. */
6.2 FUNCTIONS
AddTime()
This function is used to add the time in one timeval
structure with the time in another timeval structure.
Synopsis: AddTime( tiem1, time2 );
time1: (struct timeval *) Pointer to the first timeval
structure. The value of the second timeval
structure will be added with this timeval
structure, and the result stored here.
time1: (struct timeval *) Pointer to the second timeval
structure.
CmpTime()
This function is used to compare two timeval structures and
returns 0 if they were identical, -1 if the first timeval
structure was greater than the second, and 1 if the opposite
(the second timeval structure was greater than the first).
Synopsis: dif = CmpTime( time1, time2 );
dif: (long) If the two time values were identical 0 is
returned. If the first time value was greater than
the second time value -1 is returned, and if the
opposite (the second time value is greater than the
first time value) 1 is returned.
time1: (struct timeval *) Pointer to the first timeval
structure.
time1: (struct timeval *) Pointer to the second timeval
structure.
SubTime()
This function is used to subtract the time in one timeval
structure with the time in another timeval structure.
Synopsos: SubTime( tiem1, time2 );
time1: (struct timeval *) Pointer to the first timeval
structure. The value of the second timeval
structure will be subtracted with this timeval
structure, and the result stored here.
time1: (struct timeval *) Pointer to the second timeval
structure.