Autor Beitrag
Ironhead
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Fr 28.09.07 22:37 
hab mal ne Frage, ich hab nen Counter zum runterfahren und soweit gehts ja nur fehlt der restzeit gegenüber der system und der eingestellten zeit immer 1 Sekunde.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm2.Timer1Timer(Sender: TObject);
var
  Differenzzeit  :TTime;
begin
  LEDDisplay1.Text := FormatDateTime('hh:nn:ss', Time );
  Differenzzeit  := strToTime(LEDDisplay2.Text) - Time;
  LEDDisplay3.Text := FormatDateTime('hh:nn:ss', Differenzzeit );
end;


hab mal das bild hochgeladen, damit man so ungefähr weis was ich meine
vielelicht kann mir einer erklären wo mein denkfehler iss
Einloggen, um Attachments anzusehen!
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Fr 28.09.07 22:47 
Stell mal TTimer.Interval auf 500ms, so dass die Anzeige 2 mal die Sekunde aktualisiert wird. Wenn der Interval auf 1000 ms eingestellt ist (ich vermute mal, dass das bei Dir der Fall ist) sollte man das von Dir beschriebene beobachten können da Dein Programm nur in Ausnahmefällen genau zur vollen Sekunde gestartet wird => Rundungsfehler.

_________________
Ich streite einsam mich mit dieser Oberflächenwelt
Gutes sei ein löblich Brot von dem ich zehre - bis zum Tod [Das Ich - Im Ich]
Ironhead Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Fr 28.09.07 22:52 
ich hab den Intervall sogar schon nur auf 1 stehen, daran kanns also denk ich mal nicht liegen

Moderiert von user profile iconNarses: Doppelposting entfernt.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 29.09.07 07:44 
Machs mal lieber so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm2.Timer1Timer(Sender: TObject);
var
  DifferenzZeit: TTime;
  AktuelleZeit:  TTime;
begin
  AktuelleZeit := Time;

  LEDDisplay1.Text := FormatDateTime('hh:nn:ss', AktuelleZeit);
  Differenzzeit    := StrToTime(LEDDisplay2.Text) - AktuelleZeit;
  LEDDisplay3.Text := FormatDateTime('hh:nn:ss', Differenzzeit);
end;


Und dann stell den Timer wieder auf 500, weil 1 bringt gar nix, das kann Windows noch nicht mal.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Ironhead Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Sa 29.09.07 11:55 
Iss trotzdem noch dat selbe.
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Sa 29.09.07 12:10 
[ironie]Und wenn du einfach immer eine Sekunde dazu zählst :lol: [/ironie]
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Sa 29.09.07 14:51 
Unschön, aber erzeugt das Gewünschte.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm2.Timer1Timer(Sender: TObject);
var
  Differenzzeit  :TTime;
begin
  LEDDisplay1.Text := FormatDateTime('hh:nn:ss', Time );
  Differenzzeit  := StrToTime(LEDDisplay2.Text) - StrToTime(LEDDisplay1.Text);
  LEDDisplay3.Text := FormatDateTime('hh:nn:ss', Differenzzeit );
end;

_________________
Jailbird
Ironhead Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Sa 29.09.07 18:03 
Ja JailBird das hat es im großen und ganzen gebracht nur das ich es umdrehen musste nicht

ausblenden Delphi-Quelltext
1:
Differenzzeit  := StrToTime(LEDDisplay2.Text) - StrToTime(LEDDisplay1.Text);					


sondern, hat mich aber auf den weg gebracht

ausblenden Delphi-Quelltext
1:
Differenzzeit  := strToTime(LEDDisplay1.Text) - StrToTime(LEDDisplay2.Text);					


Danke dir.