diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-03-17 08:36:26 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-18 21:34:46 +0200 |
commit | 9830fd36dbdb72c79703b0c61efc027fba793c5a (patch) | |
tree | 2e9d698e6ca109dc6627adb5c84aa2b635bcfe92 /sc/source | |
parent | 5aaaf0694b6e3213685563fc3bc90d19b10f5c75 (diff) |
date/time IDL datatypes incompatible change
- nanosecond precision
- signed (allowed negative) year
Also: assorted improvements / bugfixes in date/time handling code.
Some factorisation of copy/pasted code.
Change-Id: I761a1b0b8731c82f19a0c37acbcf43d3c06d6cd6
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/dbdocutl.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 14 | ||||
-rw-r--r-- | sc/source/core/tool/chgtrack.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/chgviset.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/unitconverter.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xcl97/XclExpChangeTrack.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xcl97/XclImpChangeTrack.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 12 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLConverter.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/sharedocdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 8 |
15 files changed, 58 insertions, 51 deletions
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx index eb244f779eb3..a03250aae21e 100644 --- a/sc/source/core/data/dbdocutl.cxx +++ b/sc/source/core/data/dbdocutl.cxx @@ -109,8 +109,10 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB NUMBERFORMAT_TIME, ScGlobal::eLnge ); util::Time aTime = xRow->getTime(nRowPos); - nVal = ( aTime.Hours * 3600 + aTime.Minutes * 60 + - aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR; + nVal = aTime.Hours / static_cast<double>(::Time::hourPerDay) + + aTime.Minutes / static_cast<double>(::Time::minutePerDay) + + aTime.Seconds / static_cast<double>(::Time::secondPerDay) + + aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay); bEmptyFlag = xRow->wasNull(); bValue = sal_True; } @@ -125,8 +127,10 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB util::DateTime aStamp = xRow->getTimestamp(nRowPos); nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - *pFormTable->GetNullDate() ) + - ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + - aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR; + aStamp.Hours / static_cast<double>(::Time::hourPerDay) + + aStamp.Minutes / static_cast<double>(::Time::minutePerDay) + + aStamp.Seconds / static_cast<double>(::Time::secondPerDay) + + aStamp.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay); bEmptyFlag = xRow->wasNull(); bValue = sal_True; } diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index c8f3fffbe923..703317003fd3 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -104,8 +104,6 @@ using ::com::sun::star::beans::XPropertySet; namespace { -const double D_TIMEFACTOR = 86400.0; - /** * Database connection implementation for UNO database API. Note that in * the UNO database API, column index is 1-based, whereas the interface @@ -220,8 +218,10 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons rNumType = NUMBERFORMAT_TIME; util::Time aTime = mxRow->getTime(nCol+1); - fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + - aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + fValue = aTime.Hours / static_cast<double>(::Time::hourPerDay) + + aTime.Minutes / static_cast<double>(::Time::minutePerDay) + + aTime.Seconds / static_cast<double>(::Time::secondPerDay) + + aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay); rData.SetValue(fValue); break; } @@ -231,8 +231,10 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons util::DateTime aStamp = mxRow->getTimestamp(nCol+1); fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - maNullDate ) + - ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + - aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + aStamp.Hours / static_cast<double>(::Time::hourPerDay) + + aStamp.Minutes / static_cast<double>(::Time::minutePerDay) + + aStamp.Seconds / static_cast<double>(::Time::secondPerDay) + + aStamp.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay); rData.SetValue(fValue); break; } diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 5425056769e0..254e423832b7 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2232,7 +2232,7 @@ void ScChangeTrack::Init() bInDeleteUndo = false; bInPasteCut = false; bUseFixDateTime = false; - bTime100thSeconds = true; + bTimeNanoSeconds = true; const SvtUserOptions& rUserOpt = SC_MOD()->GetUserOptions(); OUStringBuffer aBuf; @@ -4556,7 +4556,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const } ScChangeTrack* pClonedTrack = new ScChangeTrack( pDocument ); - pClonedTrack->SetTime100thSeconds( IsTime100thSeconds() ); + pClonedTrack->SetTimeNanoSeconds( IsTimeNanoSeconds() ); // clone generated actions ::std::stack< const ScChangeAction* > aGeneratedStack; diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx index 06f1f292f9c0..e924a06053d4 100644 --- a/sc/source/core/tool/chgviset.cxx +++ b/sc/source/core/tool/chgviset.cxx @@ -138,7 +138,7 @@ void ScChangeViewSettings::AdjustDateMode( const ScDocument& rDoc ) // all together during the gap between those two times. aFirstDateTime += Time( 0, 1 ); aFirstDateTime.SetSec(0); - aFirstDateTime.Set100Sec(0); + aFirstDateTime.SetNanoSec(0); } } if ( !pLast ) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index ad4daa7443e8..5743f1d5f2f2 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -51,6 +51,7 @@ using namespace formula; #define SCdEpsilon 1.0E-7 +#define D_TIMEFACTOR static_cast<double>(::Time::secondPerDay) //----------------------------------------------------------------------------- // Datum und Zeit @@ -113,10 +114,10 @@ void ScInterpreter::ScGetActTime() Date aActDate( Date::SYSTEM ); long nDiff = aActDate - *(pFormatter->GetNullDate()); Time aActTime( Time::SYSTEM ); - double nTime = ((double)aActTime.Get100Sec() / 100 + - (double)(aActTime.GetSec() + - (aActTime.GetMin() * 60) + - (aActTime.GetHour() * 3600))) / DATE_TIME_FACTOR; + double nTime = aActTime.GetHour() / static_cast<double>(::Time::hourPerDay) + + aActTime.GetMin() / static_cast<double>(::Time::minutePerDay) + + aActTime.GetSec() / static_cast<double>(::Time::secondPerDay) + + aActTime.GetNanoSec() / static_cast<double>(::Time::nanoSecPerDay); PushDouble( (double) nDiff + nTime ); } @@ -149,8 +150,8 @@ void ScInterpreter::ScGetMin() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMin" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg - long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 3600; - PushDouble( (double) (nVal/60) ); + long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % ::Time::secondPerHour; + PushDouble( (double) (nVal / ::Time::secondPerMinute) ); } void ScInterpreter::ScGetSec() @@ -158,7 +159,7 @@ void ScInterpreter::ScGetSec() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetSec" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg - long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 60; + long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % ::Time::secondPerMinute; PushDouble( (double) nVal ); } @@ -167,7 +168,7 @@ void ScInterpreter::ScGetHour() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetHour" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg - long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) / 3600; + long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) / ::Time::secondPerHour; PushDouble((double) nVal); } @@ -288,7 +289,7 @@ void ScInterpreter::ScGetTime() double nSec = GetDouble(); double nMin = GetDouble(); double nHour = GetDouble(); - double fTime = fmod( (nHour * 3600) + (nMin * 60) + nSec, DATE_TIME_FACTOR) / DATE_TIME_FACTOR; + double fTime = fmod( (nHour * ::Time::secondPerHour) + (nMin * ::Time::secondPerMinute) + nSec, DATE_TIME_FACTOR) / DATE_TIME_FACTOR; if (fTime < 0) PushIllegalArgument(); else diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index cb4b1645df07..d7dd473e23ea 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -169,7 +169,7 @@ static void lcl_AddStamp( String& rStr, const String& rName, { Date aD(rDateTime.Day, rDateTime.Month, rDateTime.Year); Time aT(rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds, - rDateTime.HundredthSeconds); + rDateTime.NanoSeconds); DateTime aDateTime(aD,aT); String aStrDate = rLoc.getDate( aDateTime ); diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx index 632103b05135..20d9c487258c 100644 --- a/sc/source/filter/oox/unitconverter.cxx +++ b/sc/source/filter/oox/unitconverter.cxx @@ -58,10 +58,10 @@ inline sal_Int32 lclIsLeapYear( sal_Int32 nYear ) return ((nYear % 4) == 0) && (((nYear % 100) != 0) || ((nYear % 400) == 0)); } -void lclSkipYearBlock( sal_Int32& ornDays, sal_uInt16& ornYear, sal_Int32 nDaysInBlock, sal_Int32 nYearsPerBlock, sal_Int32 nMaxBlocks ) +void lclSkipYearBlock( sal_Int32& ornDays, sal_Int16& ornYear, sal_Int32 nDaysInBlock, sal_Int32 nYearsPerBlock, sal_Int32 nMaxBlocks ) { sal_Int32 nBlocks = ::std::min< sal_Int32 >( ornDays / nDaysInBlock, nMaxBlocks ); - ornYear = static_cast< sal_uInt16 >( ornYear + nYearsPerBlock * nBlocks ); + ornYear = static_cast< sal_Int16 >( ornYear + nYearsPerBlock * nBlocks ); ornDays -= nBlocks * nDaysInBlock; } diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 9b0767aadfbb..708d7642e853 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -49,10 +49,10 @@ static OString lcl_DateTimeToOString( const DateTime& rDateTime ) { char sBuf[ 200 ]; snprintf( sBuf, sizeof( sBuf ), - "%d-%02d-%02dT%02d:%02d:%02d.%02dZ", + "%d-%02d-%02dT%02d:%02d:%02d.%09dZ", rDateTime.GetYear(), rDateTime.GetMonth(), rDateTime.GetDay(), rDateTime.GetHour(), rDateTime.GetMin(), rDateTime.GetSec(), - rDateTime.Get100Sec() ); + rDateTime.GetNanoSec() ); return OString( sBuf ); } @@ -624,7 +624,7 @@ XclExpChTrAction::XclExpChTrAction( bForceInfo( false ) { aDateTime.SetSec( 0 ); - aDateTime.Set100Sec( 0 ); + aDateTime.SetNanoSec( 0 ); } XclExpChTrAction::~XclExpChTrAction() diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 976c1f83d451..948543a595eb 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -128,7 +128,7 @@ void XclImpChangeTrack::ReadDateTime( DateTime& rDateTime ) rDateTime.SetHour( nHour ); rDateTime.SetMin( nMin ); rDateTime.SetSec( nSec ); - rDateTime.Set100Sec( 0 ); + rDateTime.SetNanoSec( 0 ); } sal_Bool XclImpChangeTrack::CheckRecord( sal_uInt16 nOpCode ) diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 6caf7b05c81d..a28dd7725153 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -428,13 +428,13 @@ void ScXMLChangeTrackingImportHelper::EndChangeAction() void ScXMLChangeTrackingImportHelper::ConvertInfo(const ScMyActionInfo& aInfo, String& rUser, DateTime& aDateTime) { Date aDate(aInfo.aDateTime.Day, aInfo.aDateTime.Month, aInfo.aDateTime.Year); - Time aTime(aInfo.aDateTime.Hours, aInfo.aDateTime.Minutes, aInfo.aDateTime.Seconds, aInfo.aDateTime.HundredthSeconds); + Time aTime(aInfo.aDateTime.Hours, aInfo.aDateTime.Minutes, aInfo.aDateTime.Seconds, aInfo.aDateTime.NanoSeconds); aDateTime.SetDate( aDate.GetDate() ); aDateTime.SetTime( aTime.GetTime() ); - // old files didn't store 100th seconds, enable again - if ( aInfo.aDateTime.HundredthSeconds ) - pTrack->SetTime100thSeconds( true ); + // old files didn't store nanoseconds, enable again + if ( aInfo.aDateTime.NanoSeconds ) + pTrack->SetTimeNanoSeconds( true ); const std::set<OUString>& rUsers = pTrack->GetUserCollection(); std::set<OUString>::const_iterator it = rUsers.find(aInfo.sUser); @@ -795,8 +795,8 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) if (pDoc) { pTrack = new ScChangeTrack(pDoc, aUsers); - // old files didn't store 100th seconds, disable until encountered - pTrack->SetTime100thSeconds( false ); + // old files didn't store nanoseconds, disable until encountered + pTrack->SetTimeNanoSeconds( false ); ScMyActions::iterator aItr(aActions.begin()); ScMyActions::iterator aEndItr(aActions.end()); diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index a705c0a55d0f..ae58ceff0e31 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -349,13 +349,13 @@ void ScXMLConverter::ConvertCoreToAPIDateTime(const DateTime& aDateTime, util::D rDateTime.Hours = aDateTime.GetHour(); rDateTime.Minutes = aDateTime.GetMin(); rDateTime.Seconds = aDateTime.GetSec(); - rDateTime.HundredthSeconds = aDateTime.Get100Sec(); + rDateTime.NanoSeconds = aDateTime.GetNanoSec(); } void ScXMLConverter::ConvertAPIToCoreDateTime(const util::DateTime& aDateTime, DateTime& rDateTime) { Date aDate(aDateTime.Day, aDateTime.Month, aDateTime.Year); - Time aTime(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds); + Time aTime(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.NanoSeconds); DateTime aTempDateTime (aDate, aTime); rDateTime = aTempDateTime; } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index d64966bc9299..afa49ba356b0 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -743,7 +743,7 @@ static inline sal_Bool lcl_Equal( const ScChangeAction* pA, const ScChangeAction pA->GetType() == pB->GetType() && pA->GetUser() == pB->GetUser() && (bIgnore100Sec ? - pA->GetDateTimeUTC().IsEqualIgnore100Sec( pB->GetDateTimeUTC() ) : + pA->GetDateTimeUTC().IsEqualIgnoreNanoSec( pB->GetDateTimeUTC() ) : pA->GetDateTimeUTC() == pB->GetDateTimeUTC()); // State nicht vergleichen, falls eine alte Aenderung akzeptiert wurde } @@ -762,7 +762,7 @@ static bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScD if ( pAction->GetType() == pA->GetType() && pAction->GetUser() == pA->GetUser() && (bIgnore100Sec ? - pAction->GetDateTimeUTC().IsEqualIgnore100Sec( pA->GetDateTimeUTC() ) : + pAction->GetDateTimeUTC().IsEqualIgnoreNanoSec( pA->GetDateTimeUTC() ) : pAction->GetDateTimeUTC() == pA->GetDateTimeUTC() ) && pAction->GetBigRange() == pA->GetBigRange() ) { @@ -807,9 +807,9 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck } } - // include 100th seconds in compare? - sal_Bool bIgnore100Sec = !pSourceTrack->IsTime100thSeconds() || - !pThisTrack->IsTime100thSeconds(); + // include Nano seconds in compare? + sal_Bool bIgnore100Sec = !pSourceTrack->IsTimeNanoSeconds() || + !pThisTrack->IsTimeNanoSeconds(); // gemeinsame Ausgangsposition suchen sal_uLong nFirstNewNumber = 0; @@ -1189,7 +1189,7 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) aDocument.SetChangeViewSettings( aChangeViewSet ); // find first merge action in this document - sal_Bool bIgnore100Sec = !pThisTrack->IsTime100thSeconds() || !pSharedTrack->IsTime100thSeconds(); + sal_Bool bIgnore100Sec = !pThisTrack->IsTimeNanoSeconds() || !pSharedTrack->IsTimeNanoSeconds(); ScChangeAction* pThisAction = pThisTrack->GetFirst(); ScChangeAction* pSharedAction = pSharedTrack->GetFirst(); while ( lcl_Equal( pThisAction, pSharedAction, bIgnore100Sec ) ) diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 12a72e0ee82d..86fc0a5583f8 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -209,7 +209,7 @@ void ScShareDocumentDlg::UpdateView() util::DateTime uDT(xDocProps->getModificationDate()); Date d(uDT.Day, uDT.Month, uDT.Year); - Time t(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds); + Time t(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.NanoSeconds); DateTime aDateTime(d,t); aString += ScGlobal::pLocaleData->getDate( aDateTime ); diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index c42c119990ca..9fd7f1c81fb3 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -950,7 +950,7 @@ void ScEditFieldObj::setPropertyValueDateTime(const OUString& rName, const uno:: else if (rName == SC_UNONAME_DATETIME) { maDateTime = rVal.get<util::DateTime>(); - Time aTime(maDateTime.Hours, maDateTime.Minutes, maDateTime.Seconds, maDateTime.HundredthSeconds); + Time aTime(maDateTime.Hours, maDateTime.Minutes, maDateTime.Seconds, maDateTime.NanoSeconds); p->SetFixTime(aTime); } else if (rName == SC_UNONAME_NUMFMT) @@ -1012,7 +1012,7 @@ uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName) maDateTime.Hours = 0; maDateTime.Minutes = 0; maDateTime.Seconds = 0; - maDateTime.HundredthSeconds = 0; + maDateTime.NanoSeconds = 0; return uno::makeAny(maDateTime); } @@ -1056,7 +1056,7 @@ uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName) maDateTime.Hours = aT.GetHour(); maDateTime.Minutes = aT.GetMin(); maDateTime.Seconds = aT.GetSec(); - maDateTime.HundredthSeconds = aT.Get100Sec(); + maDateTime.NanoSeconds = aT.GetNanoSec(); return uno::makeAny(maDateTime); } diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index ec0f6d421c90..b61c9fffe0a6 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -250,10 +250,10 @@ void ScViewFunc::InsertCurrentTime(short nCellFmt, const OUString& rUndoStr) Date aActDate( Date::SYSTEM ); double fDate = aActDate - *pFormatter->GetNullDate(); Time aActTime( Time::SYSTEM ); - double fTime = - aActTime.Get100Sec() / 100.0 + aActTime.GetSec() + - (aActTime.GetMin() * 60.0) + (aActTime.GetHour() * 3600.0); - fTime /= DATE_TIME_FACTOR; + double fTime = aActTime.GetHour() / static_cast<double>(::Time::hourPerDay) + + aActTime.GetMin() / static_cast<double>(::Time::minutePerDay) + + aActTime.GetSec() / static_cast<double>(::Time::secondPerDay) + + aActTime.GetNanoSec() / static_cast<double>(::Time::nanoSecPerDay); pUndoMgr->EnterListAction(rUndoStr, rUndoStr); pDocSh->GetDocFunc().SetValueCell(aCurPos, fDate+fTime, true); |