Thema: Delphi Transfer time values

Einzelnen Beitrag anzeigen

sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

Transfer time values

  Alt 9. Jun 2010, 18:52
Delphi-Version: 2005
Hi , i want to Transfer an Elapsed time from timer to an other time ;

i use the following code to calc the Elapsed Time :

Delphi-Quellcode:
procedure TForm1.Time1Timer(Sender: TObject);
var
    s: string;
    TotalTime: TDateTime;
    DLTimes: Double;
    Hh, Mh, sSec, MSs: Word;
begin
TotalTime:= Now-FStartTime;


  DecodeTime(TotalTime, hH, Mh, sSec, MSs);
  sSec := sSec + Mh * 60 + hH * 3600;
   DLTimes := sSec + MSs / 1000;
  s:=Format('%2d:%2d:%2d', [sSec div 3600, (sSec div 60) mod 60, sSec mod 60]);
FElapsedTime:=FormatDateTime('hh:nn:ss', StrToTime(s));
end
So what i want to do is : when i stop timer1 and start timer2 then
timer2 will continue incrementing the FElapsedTime value .

let me suppose this :

when i stopped timer1 the FElapsedTime value was : 00:50:00 ; then when i start Timer2 the FElapsedTime value will be 00:51:00 ....etc incrementing the FElapsedTime value .


thank you
  Mit Zitat antworten Zitat