* Better precision for samedatetime. Issue ID #39023, patch by Zoran Vučenović

git-svn-id: trunk@49517 -
This commit is contained in:
michael 2021-06-20 08:00:01 +00:00
parent 436b8c2121
commit 492a0ffcac

View File

@ -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;