TDateTime is a double floating point. To minimize rounding errors when working with TDateTime values, most calculations in DateUtils convert TDateTime to milliseconds.
Later, when the calculations are ready, the Int64 value again returns to the TDateTime .
The internal labeling is to emphasize that this function is an implementation detail, and not used outside the library. That is, when working with TDateTime values, use public functions / procedures.
This is a small test of the MilliSecondsBetween function:
program TestMSecBetween; {$APPTYPE CONSOLE} uses System.SysUtils,System.DateUtils; var d1,d2 : TDateTime; i,iSec,iMin,iHour,iMSec; isb : Int64; begin d1 := EncodeDateTime(2013,6,14,0,0,0,0); for i := 0 to 1000*60*60*24-1 do begin iHour := (i div (1000*60*60)) mod 24; iMin := (i div (1000*60)) mod 60; iSec := (i div 1000) mod 60; iMSec := i mod 1000; d2 := EncodeDateTime(2013,6,14,iHour,iMin,iSec,iMSec); isb := MilliSecondsBetween(d2,d1); if (isb <> i) then WriteLn(i:10,iHour:3,iMin:3,iSec:3,iMSec:4,isb:3); end; ReadLn; end.
You can expand the test for more than one day to find out if there are any anomalies.