aqm
asked on
Simple Question about Time
Hi,
I'm new in Delphi...
How I can take the time to do a Query in miliseconds ?
Thanks in advance !
I'm new in Delphi...
How I can take the time to do a Query in miliseconds ?
Thanks in advance !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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;
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,
{ display millisecons }
label3.caption := inttostr(msec);
end;
var
TimeAfter, TimeBefore : TDateTime;
.
TimeBefore := Time;
// Do your stuff here
TimeAfter := Time;
// How many milliseconds?
x := (TimeAfter - TimeBefore) * (86400 * 1000); // 86400 seconds/day...
Cheers,
Raymond.