![]() |
TimeStampToDateTime - difference Delphi5 - Delphi7
Hello,
On my computer I recently installed Delphi 7. In my latest project I used to use this routine: // in other routine: Starttime := GetTickCount(); // in other routne: perform action function CalcTimeNeeded : string; var Starttime, delta : Comp; begin delta := GetTickCount() - StartTime; result := FormatDateTime('hh"h":nn"m":ss"s":zzz"ms"',TimeSta mpToDateTime(MSecsToTimeStamp(delta))); end; In Delphi5 this works perfect. In Delphi7 I get an exception-error on TimeStampToDateTime. How can I get this working in Delphi7 (or later???) Thanks in Advance. Jan. |
Re: TimeStampToDateTime - difference Delphi5 - Delphi7
What exception ist thrown?
|
Re: TimeStampToDateTime - difference Delphi5 - Delphi7
Hi Jan,
you should get rid of the global variable StartTime and there is no need to employ the TTimeStamp structure:
Delphi-Quellcode:
Kind regards
function TicksToStr(ticks: Cardinal): String;
begin Result := FormatDateTime('hh"h":nn"m":ss"s":zzz"ms"', ticks / MSecsPerDay); end; |
Re: TimeStampToDateTime - difference Delphi5 - Delphi7
Hi
The exception raised is: Project ... raised exception class EConvertError with message "0.8906" is not a valid timestamp". Nice routine, marabu, with TicksToStr.. I'm going to try it. Thanks. Jan. |
Re: TimeStampToDateTime - difference Delphi5 - Delphi7
Zitat:
|
Re: TimeStampToDateTime - difference Delphi5 - Delphi7
Hi Markus,
there is nothing wrong with that - it is an internal message displayed, after all. MSecsToTimeStamp() is implemented differently under D7 and enforces the rule that the Date part of a TimeStamp must be >= 1. D5 didn't care about this. Kind Regards |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:04 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