mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 02:28:22 +02:00
* Better precision for samedatetime. Issue ID #39023, patch by Zoran Vučenović
git-svn-id: trunk@49517 -
This commit is contained in:
parent
436b8c2121
commit
492a0ffcac
@ -2060,8 +2060,21 @@ end;
|
||||
|
||||
|
||||
Function SameDateTime(const A, B: TDateTime): Boolean;
|
||||
|
||||
function MS(X: Double): Int64;
|
||||
begin
|
||||
if X >= 0 then
|
||||
X := X * MSecsPerDay + 0.5
|
||||
else if X > -1.0 then
|
||||
X := -X * MSecsPerDay + 0.5
|
||||
else
|
||||
X := X * MSecsPerDay - 0.5;
|
||||
|
||||
Result := Trunc(X);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=Abs(A-B)<OneMilliSecond;
|
||||
Result := MS(A) = MS(B);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user