summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-08 21:36:18 +0100
committerAndras Timar <andras.timar@collabora.com>2018-05-15 10:15:11 +0200
commit8f941e90e65d9a60a7c1f13b1a9549ed2d4ed399 (patch)
treeb645f3e8abe71af428b63484cb9601217a87dde2 /tools
parent980dee8f8e748f84e03cf40962ed2826b9a4dc9e (diff)
there are 3600000 seconds in an hour
regression from... commit 9830fd36dbdb72c79703b0c61efc027fba793c5a Date: Sun Mar 17 08:36:26 2013 +0100 date/time IDL datatypes incompatible change Change-Id: I2f4b64a73b5529ba190acc678d907761bb568bbf Reviewed-on: https://gerrit.libreoffice.org/54010 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit 4fd9ba592c2a9a566813942b06c864ad37e96243)
Diffstat (limited to 'tools')
-rw-r--r--tools/CppunitTest_tools_test.mk1
-rw-r--r--tools/qa/cppunit/test_time.cxx41
-rw-r--r--tools/source/datetime/ttime.cxx2
3 files changed, 43 insertions, 1 deletions
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index 8cd8e7c3e9b3..547b7e9c16f0 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_use_external,tools_test,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_bigint \
tools/qa/cppunit/test_date \
+ tools/qa/cppunit/test_time \
tools/qa/cppunit/test_fract \
tools/qa/cppunit/test_inetmime \
tools/qa/cppunit/test_pathutils \
diff --git a/tools/qa/cppunit/test_time.cxx b/tools/qa/cppunit/test_time.cxx
new file mode 100644
index 000000000000..f1915b71baa1
--- /dev/null
+++ b/tools/qa/cppunit/test_time.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <tools/time.hxx>
+
+namespace tools
+{
+class TimeTest : public CppUnit::TestFixture
+{
+public:
+ void testTime();
+
+ CPPUNIT_TEST_SUITE(TimeTest);
+ CPPUNIT_TEST(testTime);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void TimeTest::testTime()
+{
+ Time aOrigTime(1, 56, 10);
+ auto nMS = aOrigTime.GetMSFromTime();
+
+ Time aNewTime(0);
+ aNewTime.MakeTimeFromMS(nMS);
+
+ CPPUNIT_ASSERT(bool(aOrigTime == aNewTime));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TimeTest);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
index cf8108306e06..97d2c8a9b180 100644
--- a/tools/source/datetime/ttime.cxx
+++ b/tools/source/datetime/ttime.cxx
@@ -288,7 +288,7 @@ sal_Int32 tools::Time::GetMSFromTime() const
( nNanoSec/1000000 +
nSec * 1000 +
nMin * 60000 +
- nHour * 360000 );
+ nHour * 3600000 );
}
void tools::Time::MakeTimeFromMS( sal_Int32 nMS )