home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff339.lzh
/
PCQ
/
Examples
/
TimerTest.p
< prev
next >
Wrap
Text File
|
1990-03-19
|
867b
|
36 lines
Program TimerTest;
{
A very simple example of using the timer.device and its
support functions.
}
{$I ":Include/Ports.i"}
{$I ":Include/ExecIO.i"}
{$I ":Include/TimerDevice.i"}
{$I ":Include/TimerUtils.i"}
var
T : TimerRequestPtr;
StartTime,
EndTime : TimeVal;
begin
T := CreateTimer;
if T <> Nil then begin
GetSysTime(T, StartTime);
Writeln('Started at ', Float(StartTime.tvSecs and $FFFF) +
(Float(StartTime.tvMicro) / 1000000.0):0:8);
Writeln('Wait about 4 seconds....');
WaitTimer(T, 4, 0);
GetSysTime(T, EndTime);
Writeln('Ended at ', Float(EndTime.tvSecs and $FFFF) +
(Float(EndTime.tvMicro) / 1000000.0):0:8);
SubTime(EndTime, StartTime);
Writeln('Difference: ', Float(EndTime.tvSecs and $FFFF) +
Float(EndTime.tvMicro) / 1000000.0:0:8);
DeleteTimer(T);
end else
Writeln('Could not open timer.');
end.