diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-23 19:27:52 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-23 19:28:19 +0200 |
commit | 3810c9cc78ae8a4e96c216b725cd400f97934b45 (patch) | |
tree | 263f1f3dbbe1c86735da593800ecfdc512463850 /oox | |
parent | b5fea2f46a1f33af2198e7da0bad027589fce5d2 (diff) |
fixup nanosecond precision
Change-Id: I9ab4c199632a5f5ad94dc01aa383e26f48bbf631
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/dump/dumperbase.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 867a66f1f4e3..accc59356390 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -31,6 +31,7 @@ #include "oox/core/filterbase.hxx" #include "oox/helper/binaryoutputstream.hxx" #include "oox/helper/textinputstream.hxx" +#include <tools/time.hxx> #if OOX_INCLUDE_DUMPER @@ -2260,10 +2261,10 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName ) ItemGuard aItem( mxOut, rName( "file-time" ) ); sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING ); - // file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds - nFileTime /= 100000; + // file time is in 10^-7 seconds (100 nanoseconds), convert to nanoseconds + nFileTime *= 100; // entire days - sal_Int64 nDays = nFileTime / sal_Int64( 360000 * 24 ); + sal_Int64 nDays = nFileTime / sal_Int64( ::Time::nanoSecPerDay ); // number of entire years sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365; // remaining days in the year @@ -2286,16 +2287,16 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName ) // the day aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 ); // number of nanoseconds in the day - sal_Int64 nTimeInDay = nFileTime % sal_Int64( 86400000000000 ); + sal_Int64 nTimeInDay = nFileTime % sal_Int64( ::Time::nanoSecPerDay ); // nanoseconds - aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % 1000000000 ); - nTimeInDay /= 1000000000; + aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % ::Time::nanoSecPerSec ); + nTimeInDay /= ::Time::nanoSecPerSec; // seconds - aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 ); - nTimeInDay /= 60; + aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % ::Time::secondPerMinute ); + nTimeInDay /= ::Time::secondPerMinute; // minutes - aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % 60 ); - nTimeInDay /= 60; + aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay ::Time::minutePerHour ); + nTimeInDay /= ::Time::minutePerHour; // hours aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay ); |