Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
{$APPTYPE CONSOLE}
program prog1; uses windows;
{ demonstration of the multi-media timer }
function timeGetTime: DWord; stdcall; external 'winmm.dll' name 'timeGetTime';
var
InitialTime, EndTime: DWord;
x, y: integer;
begin
for y := 1 to 10 do
begin
InitialTime := timeGetTime;
for x := 1 to 100 do
sleep(10);
EndTime := timeGetTime;
writeln(EndTime - InitialTime, ' ms.');
end;
write('Press ENTER.');
readln;
end.
{$APPTYPE CONSOLE}
program prog2; uses windows;
{ demonstration of the NT high-res timer }
type
Int64 = Comp;
function QueryPerformanceFrequency(var lpFrequency: Int64): boolean;
stdcall; external 'kernel32.dll' name 'QueryPerformanceFrequency';
function QueryPerformanceCounter(var lpPerformanceCount: Int64): boolean;
stdcall; external 'kernel32.dll' name 'QueryPerformanceCounter';
var
x, y: integer;
lFreq: Int64;
InitialF, FinalF: Int64;
begin
if QueryPerformanceFrequency(lFreq) then
writeln('Hi-Res Timer Supported.')
else
// also can exit out here.
writeln('Hi-Res Timer Not Supported.');
writeln('Frequency: ', lFreq:0:0, ' units per second.');
writeln('Time Resolution: ', (1 / lFreq):0:16, ' seconds.');
for y := 1 to 10 do
begin
QueryPerformanceCounter(InitialF);
for x := 1 to 100 do
sleep(10);
QueryPerformanceCounter(FinalF);
writeln(' Duration: ', (FinalF - InitialF):0:0);
// if you save this to variable, it needs to be Extended
writeln( ((FinalF-InitialF) / lFreq):0:16, ' seconds.');
end;
write('Press ENTER.');
readln;
end.