From d8c81744d317df236d8c17b516e6e488c0fc40d1 Mon Sep 17 00:00:00 2001 From: joost Date: Sat, 30 Nov 2019 11:04:19 +0000 Subject: [PATCH] * Fix for timestamps very close to a whole day in Firebird git-svn-id: trunk@43615 - --- packages/fcl-db/src/sqldb/interbase/ibconnection.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/fcl-db/src/sqldb/interbase/ibconnection.pp b/packages/fcl-db/src/sqldb/interbase/ibconnection.pp index 077e943f0c..e6cfcb3830 100644 --- a/packages/fcl-db/src/sqldb/interbase/ibconnection.pp +++ b/packages/fcl-db/src/sqldb/interbase/ibconnection.pp @@ -1442,6 +1442,13 @@ begin {$ELSE} PISC_TIMESTAMP(CurrBuff)^.timestamp_date := Trunc(PTime) + IBDateOffset; PISC_TIMESTAMP(CurrBuff)^.timestamp_time := Round(abs(Frac(PTime)) * IBTimeFractionsPerDay); + if PISC_TIMESTAMP(CurrBuff)^.timestamp_time = IBTimeFractionsPerDay then + begin + // If PTime is for example 0.99999999999999667, the time-portion of the + // TDateTime is rounded into a whole day. Firebird does not accept that. + inc(PISC_TIMESTAMP(CurrBuff)^.timestamp_date); + PISC_TIMESTAMP(CurrBuff)^.timestamp_time := 0; + end; {$ENDIF} end else