summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-29 09:27:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-09-29 11:41:43 +0200
commitc039ba3d68cb6668b672c299075417f65183c65a (patch)
treeb580bd710b74c75b8607e71cb0a3d759221340e4 /connectivity
parentfbfd91f2c5f4d66570c2d5a6f048b21f5d1671a4 (diff)
ofz#39403 avoid Integer-overflow
Change-Id: I3471e2fbd2b47dbc681aa3069794184eb9ab33e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122796 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbconversion.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 96b1f1dcfd0a..cae8470479c3 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -332,10 +332,10 @@ namespace dbtools
css::util::Time DBTypeConversion::toTime(const double dVal, short nDigits)
{
- const sal_Int32 nDays = static_cast<sal_Int32>(dVal);
+ const double nDays = std::trunc(dVal);
sal_Int64 nNS;
{
- double fSeconds((dVal - static_cast<double>(nDays)) * (fNanoSecondsPerDay / nanoSecInSec));
+ double fSeconds((dVal - nDays) * (fNanoSecondsPerDay / nanoSecInSec));
fSeconds = ::rtl::math::round( fSeconds, nDigits );
nNS = fSeconds * nanoSecInSec;
}