Registriert seit: 29. Sep 2004
Ort: Wettingen
50 Beiträge
Delphi 2006 Professional
|
Re: Berechnung einer bestimmten Prüfdauer
4. Apr 2005, 13:27
Falls es jemanden interessiert...
... sicher nicht die beste Möglichkeit aber soweit läufts!
Das ganze nun gelöst:
Delphi-Quellcode:
var
Te,Ts :TDateTime;
Present :TDateTime;
Hour, Min, Sec, MSec: Word;
Beginn_T_T1 :String;
begin
Ts := StrToTime(Beginn_T_T1);
Te := Time();
if Te < Ts then Te := Te + 1;
Present := (Ts - Te);
if TimeToStr(Ts - Te) = '00:00:00' then inc(Day1);
Case Day1 of
0: L_TestTime1_1.Caption := TimeToStr(Present);
1: begin
DecodeTime(Present, Hour, Min, Sec, MSec);
Hour := Hour + 24;
if Sec < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':'+IntToStr(Min)+':0'+IntToStr(Sec);
if Min < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':'+IntToStr(Sec);
if (Min < 10) AND (Sec < 10) then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':0'+IntToStr(Sec);
end;
2: begin
DecodeTime(Present, Hour, Min, Sec, MSec);
Hour := Hour + 48;
if Sec < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':'+IntToStr(Min)+':0'+IntToStr(Sec);
if Min < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':'+IntToStr(Sec);
if (Min < 10) AND (Sec < 10) then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':0'+IntToStr(Sec);
end;
3: begin
DecodeTime(Present, Hour, Min, Sec, MSec);
Hour := Hour + 72;
if Sec < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':'+IntToStr(Min)+':0'+IntToStr(Sec);
if Min < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':'+IntToStr(Sec);
if (Min < 10) AND (Sec < 10) then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':0'+IntToStr(Sec);
end;
4: begin
DecodeTime(Present, Hour, Min, Sec, MSec);
Hour := Hour + 96;
if Sec < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':'+IntToStr(Min)+':0'+IntToStr(Sec);
if Min < 10 then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':'+IntToStr(Sec);
if (Min < 10) AND (Sec < 10) then
L_TestTime1_1.Caption := IntToStr(Hour)+':0'+IntToStr(Min)+':0'+IntToStr(Sec);
end;
end;
|
|
Zitat
|