Kaydet (Commit) 3810c9cc authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

fixup nanosecond precision

Change-Id: I9ab4c199632a5f5ad94dc01aa383e26f48bbf631
üst b5fea2f4
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "oox/core/filterbase.hxx" #include "oox/core/filterbase.hxx"
#include "oox/helper/binaryoutputstream.hxx" #include "oox/helper/binaryoutputstream.hxx"
#include "oox/helper/textinputstream.hxx" #include "oox/helper/textinputstream.hxx"
#include <tools/time.hxx>
#if OOX_INCLUDE_DUMPER #if OOX_INCLUDE_DUMPER
...@@ -2260,10 +2261,10 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName ) ...@@ -2260,10 +2261,10 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName )
ItemGuard aItem( mxOut, rName( "file-time" ) ); ItemGuard aItem( mxOut, rName( "file-time" ) );
sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING ); sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING );
// file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds // file time is in 10^-7 seconds (100 nanoseconds), convert to nanoseconds
nFileTime /= 100000; nFileTime *= 100;
// entire days // entire days
sal_Int64 nDays = nFileTime / sal_Int64( 360000 * 24 ); sal_Int64 nDays = nFileTime / sal_Int64( ::Time::nanoSecPerDay );
// number of entire years // number of entire years
sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365; sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365;
// remaining days in the year // remaining days in the year
...@@ -2286,16 +2287,16 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName ) ...@@ -2286,16 +2287,16 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName )
// the day // the day
aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 ); aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
// number of nanoseconds in the day // number of nanoseconds in the day
sal_Int64 nTimeInDay = nFileTime % sal_Int64( 86400000000000 ); sal_Int64 nTimeInDay = nFileTime % sal_Int64( ::Time::nanoSecPerDay );
// nanoseconds // nanoseconds
aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % 1000000000 ); aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % ::Time::nanoSecPerSec );
nTimeInDay /= 1000000000; nTimeInDay /= ::Time::nanoSecPerSec;
// seconds // seconds
aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 ); aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % ::Time::secondPerMinute );
nTimeInDay /= 60; nTimeInDay /= ::Time::secondPerMinute;
// minutes // minutes
aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % 60 ); aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay ::Time::minutePerHour );
nTimeInDay /= 60; nTimeInDay /= ::Time::minutePerHour;
// hours // hours
aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay ); aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment