Commits

Caolán McNamara  committed 4341479

cmcfixes79: #i114619#: 100th second resolution export/import to Win32 bit timestamps

  • Participants
  • Parent commits 8ebf0dc

Comments (0)

Files changed (1)

File tools/source/datetime/datetime.cxx

 
 void DateTime::GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper )
 {
+    const sal_Int64 a100nPer100thSecond = SAL_CONST_INT64( 100000 );
     const sal_Int64 a100nPerSecond = SAL_CONST_INT64( 10000000 );
     const sal_Int64 a100nPerDay = a100nPerSecond * sal_Int64( 60 * 60 * 24 );
 
         a100nPerSecond * (
                 sal_Int64( GetSec() ) +
                 60 * sal_Int64( GetMin() ) +
-                60 * 60 * sal_Int64( GetHour() ) );
+                60 * 60 * sal_Int64( GetHour() ) ) + 
+                    a100nPer100thSecond * Get100Sec();
 
     rLower = sal_uInt32( aTime % SAL_CONST_UINT64( 0x100000000 ) );
     rUpper = sal_uInt32( aTime / SAL_CONST_UINT64( 0x100000000 ) );
 
 DateTime DateTime::CreateFromWin32FileDateTime( const sal_uInt32 & rLower, const sal_uInt32 & rUpper )
 {
+    const sal_Int64 a100nPer100thSecond = SAL_CONST_INT64( 100000 );
     const sal_Int64 a100nPerSecond = SAL_CONST_INT64( 10000000 );
     const sal_Int64 a100nPerDay = a100nPerSecond * sal_Int64( 60 * 60 * 24 );
 
         sal::static_int_cast< USHORT >(nYears + 1601) );
     Time _aTime( ULONG( ( aTime / ( a100nPerSecond * 60 * 60 ) ) % sal_Int64( 24 ) ),
             ULONG( ( aTime / ( a100nPerSecond * 60 ) ) % sal_Int64( 60 ) ),
-            ULONG( ( aTime / ( a100nPerSecond ) ) % sal_Int64( 60 ) ) );
+            ULONG( ( aTime / ( a100nPerSecond ) ) % sal_Int64( 60 ) ),
+            ULONG( ( aTime / ( a100nPer100thSecond ) ) % sal_Int64( 100 ) ) );
 
     return DateTime( _aDate, _aTime );
 }