Solved

Posted on 1998-10-21
852 Views
Hi,
I'm new in Delphi...

How I can take the time to do a Query in miliseconds ?

0
Question by:aqm
• 2

LVL 12

Accepted Solution

rwilson032697 earned 50 total points
ID: 1343812
Use the Win32 function GetSystemTime() or the Delphi Time function before and afterwards then work out the number of milliseconds between the two.
0

LVL 12

Expert Comment

ID: 1343813
To calculate the number of milliseconds do this (assuming you use the Delphi Time function):

var
TimeAfter, TimeBefore : TDateTime;

.
TimeBefore := Time;
TimeAfter := Time;

// How many milliseconds?
x := (TimeAfter - TimeBefore) * (86400 * 1000);  // 86400 seconds/day...

Cheers,

Raymond.

0

Expert Comment

ID: 1343814
this is the statment to get millisecons from system time

var
starttime,finishtime, actualresponse : TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
starttime := Time;
DecodeTime(starttime, Hour, Min, Sec, MSec);
{ display millisecons }
label1.caption := inttostr(msec);

Finishtime := Time;
DecodeTime(finishtime, Hour, Min, Sec, MSec);
{ display millisecons }
label2.caption := inttostr(msec);

{ you can also do this statment }
actualresponse := finishtime - starttime;
DecodeTime(actualresponse, Hour, Min, Sec, MSec);
{ display millisecons }
label3.caption := inttostr(msec);

end;

0