Re: delphi console application

Posted by Rick on December 28, 2007

In Reply to Re: delphi pascal posted by clive on December 23, 2007

: Hi yes that is what i mean if thats not possible then would it be possible to press a key to start the count then press another to stop it with it counting up one each second or something similar :-S sorry to be a pain lol

In a Delphi console application, you could do something like this, in order to measure the time interval:

WriteLn('Press ENTER to start the timer, then press ENTER again to stop it');
ReadLn; // wait for ENTER
T1 := The_Actual_Time;
T2 := The_Actual_Time;
WriteLn('Elapsed time: ', IntToStr(T2 - T1);

I'll look up the actual code for getting the current time & I'll post it tomorrow ;)

Related articles


Follow Ups