2007. szeptember 7., péntek

How to create a countdown timer (2)


Problem/Question/Abstract:

All I want to do is to read the system time of the computer, then read it again a little later, and compare the times. I want hours, minutes, seconds and milliseconds. I have looked into TimeStamp and GetSystemTime, but I just can't get it to work. What should I do?

Answer:

var
  T0, T1: TDateTime;
  ElapsedSeconds: Double;
begin
  T0 := Now;
  { ... }
  T1 := Now;
  ElapsedSeconds := 86400.0 * (T1 - T0);
end;

Nincsenek megjegyzések:

Megjegyzés küldése