![]() |
AW: Zeitcode
FormatSettings hat gefehlt, so klappt es, ich habe es getestet mit Delphi 2009.
Delphi-Quellcode:
In diesem Beispiel ist Duration.Text = 223
function GetMillisecondSpan(S1, S2: String): Int64;
var t1, t2: TDateTime; FS: TFormatSettings; begin GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FS); FS.DecimalSeparator := '.'; FS.TimeSeparator := ':'; FS.LongTimeFormat := 'hh:nn:ss.zzz'; try t1 := StrToTime(S1, FS); t2 := StrToTime(S2, FS); finally Result := MilliSecondsBetween(t1, t2); end; end; procedure TForm1.DurationClick(Sender: TObject); begin Duration.Text := IntToStr(GetMillisecondSpan('01:23:45.678', '01:23:45.901')); end;
Delphi-Quellcode:
In diesem Beispiel ist Duration.Text = 00:00:00.223
function GetDateTimeSpan ( S1, S2: String ): TDateTime;
var t1, t2: TDateTime; FS: TFormatSettings; begin GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FS); FS.DecimalSeparator := '.'; FS.TimeSeparator := ':'; FS.LongTimeFormat := 'hh:nn:ss.zzz'; try t1 := StrToTime(S1, FS); t2 := StrToTime(S2, FS); finally Result := MilliSecondsBetween(t1, t2) / (1000.0 * 86400); end; end; procedure TForm1.DurationClick(Sender: TObject); var FS: TFormatSettings; begin GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FS); FS.DecimalSeparator := '.'; FS.TimeSeparator := ':'; FS.LongTimeFormat := 'hh:nn:ss.zzz'; Duration.Text := TimeToStr(GetDateTimeSpan('01:23:45.678','01:23:45.901'), FS); end; Ich hoffe nun ist dieser Thread zufriedenstellend erledigt. |
AW: Zeitcode
Zitat:
Zitat:
![]() Gruß K-H |
AW: Zeitcode
Zitat:
|
AW: Zeitcode
Zitat:
Strg+C in Dialogen und Strg+V hier im Texteditor helfen, wenn man nocht abschreiben oder auf den Monitor schießen möchte. Und ansonsten hatte ich schon alles gesagt, was die "Frames" oder sonstwas betrifft, welches keine Millisekunden sind, sowie zum Format der Datums-String. |
AW: Zeitcode
Zitat:
Danke. : Başparmak: |
AW: Zeitcode
Zitat:
|
AW: Zeitcode
Jetzt möchte ich aber doch schon noch wissen, wie lang so ein Frame denn nun ist bzw. wie viele es davon in einer Sekunde gibt.
|
AW: Zeitcode
75 Frames sollten 1 sec sein wenn ich mich recht erinnere.
Başparmak = :thumb: Gruß K-H |
AW: Zeitcode
Zitat:
Zitat:
Je nach Interpretation der Frames als Milli- oder Zentisekunden kommt da aber 00:00:00.999 oder 00:00:00.990 raus. Nur wenn man die Frames vorher in 1/75 Sekunden umrechnet passt das Ergebnis - bis auf die dabei entstehenden Rundungsfehler. |
AW: Zeitcode
Nur wenn Frames sich auf Audio-CD bezieht. Schaut mal hier:
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:20 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