[Libreoffice-commits] core.git: vbahelper/source xmloff/source
Takeshi Abe
tabe at fixedpoint.jp
Tue May 22 06:45:25 UTC 2018
vbahelper/source/vbahelper/vbaapplicationbase.cxx | 9 ++++-----
xmloff/source/text/txtlists.cxx | 8 ++++----
2 files changed, 8 insertions(+), 9 deletions(-)
New commits:
commit 1091e786b420a964b899e9c0a9c399d07946536c
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Tue May 22 13:28:15 2018 +0900
vbahelper, xmloff: Ask current datetime only once
Change-Id: I930983fab11d30f0887965fe30b07c5ac6eef8ef
Reviewed-on: https://gerrit.libreoffice.org/54651
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 25e91647694b..2fb92cf5c786 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -78,13 +78,12 @@ public:
static double GetNow()
{
- Date aDateNow( Date::SYSTEM );
- tools::Time aTimeNow( tools::Time::SYSTEM );
- Date aRefDate( 1,1,1900 );
- long nDiffDays = aDateNow - aRefDate;
+ DateTime aNow( DateTime::SYSTEM );
+ Date aRefDate( 1,1,1900 );
+ long nDiffDays = aNow - aRefDate;
nDiffDays += 2; // Change VisualBasic: 1.Jan.1900 == 2
- long nDiffSeconds = aTimeNow.GetHour() * 3600 + aTimeNow.GetMin() * 60 + aTimeNow.GetSec();
+ long nDiffSeconds = aNow.GetHour() * 3600 + aNow.GetMin() * 60 + aNow.GetSec();
return static_cast<double>(nDiffDays) + static_cast<double>(nDiffSeconds)/double(24*3600);
}
diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index ff57fbe0f601..40c85cb63c9c 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -23,8 +23,7 @@
#include <o3tl/make_unique.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
+#include <tools/datetime.hxx>
#include <xmloff/txtimp.hxx>
#include <xmloff/xmlimp.hxx>
@@ -198,8 +197,9 @@ OUString XMLTextListsHelper::GenerateNewListId() const
else
{
// Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)
- sal_Int64 n = ::tools::Time( ::tools::Time::SYSTEM ).GetTime();
- n += Date( Date::SYSTEM ).GetDateUnsigned();
+ DateTime aDateTime( DateTime::SYSTEM );
+ sal_Int64 n = aDateTime.GetTime();
+ n += aDateTime.GetDateUnsigned();
n += comphelper::rng::uniform_int_distribution(0, std::numeric_limits<int>::max());
// Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)
sTmpStr += OUString::number( n );
More information about the Libreoffice-commits
mailing list