diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2018-05-22 13:28:15 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-22 08:45:04 +0200 |
commit | 1091e786b420a964b899e9c0a9c399d07946536c (patch) | |
tree | c8d5f8d8fd9a4ac4295764b6b545ba83ac38bed2 /vbahelper | |
parent | 038c607e4093d5a26e37d41805def1c5d65ff32d (diff) |
vbahelper, xmloff: Ask current datetime only once
Change-Id: I930983fab11d30f0887965fe30b07c5ac6eef8ef
Reviewed-on: https://gerrit.libreoffice.org/54651
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
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); } |