[fpc-devel] Definition of the time-fration in a TDateTime before 30/12/1899

Bram Kuijvenhoven kuifwaremailinglists at xs4all.nl
Mon May 22 10:54:53 CEST 2006


Michael Van Canneyt wrote:
> The following remark in the Delphi help sheds more light on the issue:
> 
> "When working with negative TDateTime values, computations must handle
> time portion separately. The fractional part reflects the fraction of
> a 24-hour day without regard to the sign of the TDateTime value.
> For example,
>   6:00 am on 12/29/1899 is -1.25,
> Not
>   -1 + 0.25,
> which would be -0.75. There are no TDateTime values between -1 and 0."

This is really bad -- I supposed the TDateTime was a nice 'linear' mapping of time (which is much nicer for all kinds of calculations). As Joost said, dateutil.inc will need quite some fixes.

I guess we will need plenty of unit tests to make sure all the functions work consistent, in particular also for dates close to and before 29-12-1899 :)

(Note: I sent some mail explaining the TryEncodeDateTime function some time ago (21-4-2006), on Graeme's request. I also mentioned an overflow problem in that code + how to fix. Perhaps this fix can be integrated into the code as well.)

Regards,

Bram



More information about the fpc-devel mailing list