summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2018-05-07 17:31:39 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2018-05-28 11:32:14 +0200
commitf122faeede515093cf9dc450c9b62fdaae603bef (patch)
treee10d072d82f097bbb0909ea0f79636a6121a4720 /basic
parent26b27c23d42247695d72167be7729e36a473f644 (diff)
basic: Avoid looking up system clock twice to get current datetime
Change-Id: I3de322a420bdbbd7906160b97dca531dfe3092a4 Reviewed-on: https://gerrit.libreoffice.org/53929 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 589105ff3935..960219ca81c0 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2224,13 +2224,12 @@ void SbRtl_Second(StarBASIC *, SbxArray & rPar, bool)
double Now_Impl()
{
- Date aDate( Date::SYSTEM );
- tools::Time aTime( tools::Time::SYSTEM );
- double aSerial = static_cast<double>(GetDayDiff( aDate ));
- long nSeconds = aTime.GetHour();
+ DateTime aDateTime( DateTime::SYSTEM );
+ double aSerial = static_cast<double>(GetDayDiff( aDateTime ));
+ long nSeconds = aDateTime.GetHour();
nSeconds *= 3600;
- nSeconds += aTime.GetMin() * 60;
- nSeconds += aTime.GetSec();
+ nSeconds += aDateTime.GetMin() * 60;
+ nSeconds += aDateTime.GetSec();
double nDays = static_cast<double>(nSeconds) / (24.0*3600.0);
aSerial += nDays;
return aSerial;