summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-05-21 18:56:52 +0200
committerJulien Nabet <serval2412@yahoo.fr>2018-05-28 16:53:08 +0200
commit91e6174a088b8c722e8c6d3482c1ae9a6818a7c5 (patch)
treef9e59aa69de02c9e947906d4c6d15a79ade43135 /dbaccess
parent6f6c61a8c0fb7fd838e0c6516276a22b7729904c (diff)
tdf#117732: Mig FB, fix reading of time
Change-Id: Ie67b50d899c4684f6fadd0c42337f54ef952078e Reviewed-on: https://gerrit.libreoffice.org/54646 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/filter/hsqldb/rowinputbinary.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
index 62c37525367d..d47901d2d7a4 100644
--- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
+++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx
@@ -333,7 +333,20 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const ColumnTypeVector& nColType
{
sal_Int64 value = 0;
m_pStream->ReadInt64(value);
- css::util::Time time((value % 1000) * 1000000, value / 1000, 0, 0, true);
+ auto valueInSecs = value / 1000;
+ sal_uInt16 nHours = 0;
+ // in negative case value is comprised between
+ // -24 * 60 * 60 and -1
+ // so add 24 * 60 * 60 in order the rest of calculus is ok
+ if (valueInSecs < 0)
+ valueInSecs += 24 * 60 * 60;
+ else
+ nHours = (valueInSecs / 3600) + 1;
+
+ valueInSecs = valueInSecs % 3600;
+ const sal_uInt16 nMins = valueInSecs / 60;
+ const sal_uInt16 nSecs = valueInSecs % 60;
+ css::util::Time time((value % 1000) * 1000000, nSecs, nMins, nHours, true);
aData.push_back(makeAny(time));
}
break;