Because Delphi did so. And the accuracy of Double is probably sufficient for the intended purpose.
Hmm. But we're both further from the epoch (1900?) than when Borland selected it (late 90s?) and expecting to be able to use smaller intervals for timeouts etc. as computers speed up (assuming, of course, that that trend continues).
I need to correct my statement a bit: it's not a
Double, because Delphi did so, but because Microsoft did so for Visual Basic and Excel.
TDateTime is fully interchangeable with the
DATE type used in OLE which is described for the
VARIANT struct
here:
Type: DATE A date and time value. Dates are represented as double-precision numbers, where midnight, January 1, 1900 is 2.0, January 2, 1900 is 3.0, and so on.
Also Delphi's documentation mentions this:
The maximal correct date supported by TDateTime values is limited to 12/31/9999 23:59:59:999.
So that's plenty of time for normal use cases...
Since a TDateTime should be treated as opaque, is binary compatibility that important?
Yes, due to above point.