![]() |
Delphi-Version: 2005
Transfer time values
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:
So what i want to do is : when i stop timer1 and start timer2 then
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 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 |
AW: Transfer time values
When timer 1 is started, you save the start time:
Delphi-Quellcode:
When timer 1 is stopped:
Timer1starttime := now;
Delphi-Quellcode:
When timer 2 is started, again you save the starttime
elapsedtime1 := now - timer1starttime;
Delphi-Quellcode:
When time 2 stops, elapsed time is:
timer2starttime := now;
Delphi-Quellcode:
Total elapsed time is
elapsedtime2 := now-timer2starttime;
Delphi-Quellcode:
totalelapsedtime := elapsedtime1 + elapsedtime2;
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:32 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz