diff options
30 files changed, 63 insertions, 56 deletions
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index f524289e3647..c3f729a0e231 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -621,11 +621,8 @@ bool SvxExtTimeField::operator==( const SvxFieldData& rOther ) const OUString SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const { - tools::Time aTime( tools::Time::EMPTY ); - if ( eType == SvxTimeType::Fix ) - aTime.SetTime(m_nFixTime); - else - aTime = tools::Time( tools::Time::SYSTEM ); // current time + tools::Time aTime(eType == SvxTimeType::Fix ? tools::Time::fromEncodedTime(m_nFixTime) + : tools::Time(tools::Time::SYSTEM)); // current time return GetFormatted( aTime, eFormat, rFormatter, eLang ); } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 055d46879aa6..0c3540051e49 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1891,12 +1891,17 @@ bool SvxAutoCorrect::CreateLanguageFile( const LanguageTag& rLanguageTag, bool b SvxAutoCorrectLanguageLists* pLists = nullptr; - tools::Time nMinTime( 0, 2 ), nAktTime( tools::Time::SYSTEM ), nLastCheckTime( tools::Time::EMPTY ); + tools::Time nAktTime(tools::Time::SYSTEM); auto nFndPos = aLastFileTable.find(rLanguageTag); - if(nFndPos != aLastFileTable.end() && - (nLastCheckTime.SetTime(nFndPos->second), nLastCheckTime < nAktTime) && - nAktTime - nLastCheckTime < nMinTime) + bool lastCheckLessThan2MinutesAgo = nFndPos != aLastFileTable.end(); + if (lastCheckLessThan2MinutesAgo) + { + const tools::Time nLastCheckTime(tools::Time::fromEncodedTime(nFndPos->second)); + lastCheckLessThan2MinutesAgo + = nLastCheckTime < nAktTime && nAktTime - nLastCheckTime < tools::Time(0, 2); + } + if (lastCheckLessThan2MinutesAgo) { // no need to test the file, because the last check is not older then // 2 minutes. diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index ed8a0de01468..e474647450e9 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -206,7 +206,7 @@ static util::DateTime getTime(sal_Int64 const nTime) { util::DateTime aTime; - tools::Time aTempTime( nTime ); + tools::Time aTempTime(tools::Time::fromEncodedTime(nTime)); aTime.NanoSeconds = aTempTime.GetNanoSec(); aTime.Seconds = aTempTime.GetSec(); diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 837a33a67342..78925d1bef0e 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -72,7 +72,7 @@ DateTime DTTM2DateTime( tools::Long lDTTM ) Friday=5 Saturday=6) */ - DateTime aDateTime(Date( 0 ), ::tools::Time( 0 )); + DateTime aDateTime(Date( 0 ), ::tools::Time( tools::Time::EMPTY )); if( lDTTM ) { sal_uInt16 lMin = static_cast<sal_uInt16>(lDTTM & 0x0000003F); diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index f32b95a4c482..ce12e1c4f184 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -721,7 +721,9 @@ void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Referenc sal_Int32 nInt32Val = 0; if (aVal >>= nInt32Val) { - ::tools::Time aTime(nInt32Val); + // Is this 32-bit number actually encoded time? Or should rather + // Time::MakeTimeFromNS be used here? + ::tools::Time aTime(tools::Time::fromEncodedTime(nInt32Val)); OUStringBuffer aBuffer; appendDigits( aTime.GetHour(), 2, aBuffer ); aBuffer.append( '-' ); diff --git a/forms/source/component/EditBase.cxx b/forms/source/component/EditBase.cxx index faf27cf3f0f7..251c54b147c3 100644 --- a/forms/source/component/EditBase.cxx +++ b/forms/source/component/EditBase.cxx @@ -185,7 +185,7 @@ void OEditBaseModel::read(const Reference<XObjectInputStream>& _rxInStream) } else if ((nAnyMask & DEFAULT_TIME) == DEFAULT_TIME) { - m_aDefault <<= ::tools::Time(_rxInStream->readHyper()).GetUNOTime(); + m_aDefault <<= ::tools::Time::fromEncodedTime(_rxInStream->readHyper()).GetUNOTime(); } else if ((nAnyMask & DEFAULT_DATE) == DEFAULT_DATE) { diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index f50db1049a77..29dbc80d2ed1 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -48,7 +48,7 @@ public: explicit DateTime( DateTimeInitSystem ); DateTime( const DateTime& rDateTime ) : Date( rDateTime ), Time( rDateTime ) {} - explicit DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} + explicit DateTime( const Date& rDate ) : Date( rDate ), Time(Time::EMPTY) {} explicit DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {} DateTime( const Date& rDate, const tools::Time& rTime ) : Date( rDate ), Time( rTime ) {} diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index 9f032539e142..ca0d7088b7e1 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -96,7 +96,7 @@ private: void SetTimeDiff(const Time& rStart, const Time& rEnd); private: - Time maTime = Time(0); + Time maTime = Time(Time::EMPTY); sal_Int32 mnDays = 0; }; } diff --git a/include/tools/time.hxx b/include/tools/time.hxx index c92bdd9aee05..9b3d15f5ec22 100644 --- a/include/tools/time.hxx +++ b/include/tools/time.hxx @@ -40,6 +40,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Time { private: sal_Int64 nTime; + explicit Time(sal_Int64 _nTime) { nTime = _nTime; } static sal_Int64 assemble(sal_uInt32 h, sal_uInt32 m, sal_uInt32 s, sal_uInt64 ns); short GetSign() const { return (nTime >= 0) ? +1 : -1; } @@ -78,13 +79,15 @@ public: explicit Time( TimeInitEmpty ) { nTime = 0; } explicit Time( TimeInitSystem ); - explicit Time( sal_Int64 _nTime ) { Time::nTime = _nTime; } Time( const tools::Time& rTime ) = default; explicit Time( const css::util::Time& rTime ); explicit Time( const css::util::DateTime& rDateTime ); Time( sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 ); + // The argument is not nanoseconds, it's what nTime must contain! + static Time fromEncodedTime(sal_Int64 _nTime) { return Time(_nTime); } + void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; } sal_Int64 GetTime() const { return nTime; } css::util::Time GetUNOTime() const { return css::util::Time(GetNanoSec(),GetSec(),GetMin(),GetHour(),false); } diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 192bc1a669e4..ae5627385fa9 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -402,7 +402,7 @@ void ScXMLChangeTrackingImportHelper::ConvertInfo(const ScMyActionInfo& aInfo, O std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateInsertAction(const ScMyInsAction* pAction) { - DateTime aDateTime( Date(0), tools::Time(0) ); + DateTime aDateTime( Date(0), tools::Time(tools::Time::EMPTY) ); OUString aUser; ConvertInfo(pAction->aInfo, aUser, aDateTime); @@ -414,7 +414,7 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateInsertAct std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateDeleteAction(const ScMyDelAction* pAction) { - DateTime aDateTime( Date(0), tools::Time(0) ); + DateTime aDateTime( Date(0), tools::Time(tools::Time::EMPTY) ); OUString aUser; ConvertInfo(pAction->aInfo, aUser, aDateTime); @@ -429,7 +429,7 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateMoveActio OSL_ENSURE(pAction->pMoveRanges, "no move ranges"); if (pAction->pMoveRanges) { - DateTime aDateTime( Date(0), tools::Time(0) ); + DateTime aDateTime( Date(0), tools::Time(tools::Time::EMPTY) ); OUString aUser; ConvertInfo(pAction->aInfo, aUser, aDateTime); @@ -443,7 +443,7 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateMoveActio std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateRejectionAction(const ScMyRejAction* pAction) { - DateTime aDateTime( Date(0), tools::Time(0) ); + DateTime aDateTime( Date(0), tools::Time(tools::Time::EMPTY) ); OUString aUser; ConvertInfo(pAction->aInfo, aUser, aDateTime); @@ -463,7 +463,7 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateContentAc sInputString = pAction->pCellInfo->sInputString; } - DateTime aDateTime( Date(0), tools::Time(0) ); + DateTime aDateTime( Date(0), tools::Time(tools::Time::EMPTY) ); OUString aUser; ConvertInfo(pAction->aInfo, aUser, aDateTime); diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 700cb97d4492..db2a3538341b 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -947,7 +947,7 @@ uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName) if (rName == SC_UNONAME_DATETIME) { - tools::Time aT(p->GetFixTime()); + tools::Time aT(tools::Time::fromEncodedTime(p->GetFixTime())); maDateTime.Year = 0; maDateTime.Month = 0; maDateTime.Day = 0; diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 56f9cc508626..fd58db937d89 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -253,10 +253,10 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, weld::Button&, rButton, void ) bool bBtnGetOneObjectEnabled = m_xBtnGetOneObject->get_sensitive(); // calculate overall time - ::tools::Time aTime( 0 ); ::tools::Long nFullTime; if( m_xRbtBitmap->get_active() ) { + ::tools::Time aTime(::tools::Time::EMPTY); for (size_t i = 0; i < nCount; ++i) { aTime += m_FrameList[i].second; @@ -266,7 +266,6 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, weld::Button&, rButton, void ) else { nFullTime = nCount * 100; - aTime.MakeTimeFromMS( nFullTime ); } // StatusBarManager from 1 second diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index d2130979c9a6..6aa790d22fc4 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -263,8 +263,6 @@ void SfxObjectShell::UpdateTime_Impl( // Initialize some local member! It's necessary for follow operations! DateTime aNow( DateTime::SYSTEM ); // Date and time at current moment - tools::Time n24Time (24,0,0,0) ; // Time-value for 24 hours - see follow calculation - tools::Time nAddTime (0) ; // Value to add on aOldTime // Save impossible cases! // User has changed time to the past between last editing and now... it's not possible!!! @@ -276,6 +274,7 @@ void SfxObjectShell::UpdateTime_Impl( { // Count of days between now and last editing sal_Int32 nDays = aNow.GetSecFromDateTime(Date(pImpl->nTime.GetDate()))/86400 ; + tools::Time nAddTime(tools::Time::EMPTY); // Value to add on aOldTime if (nDays==0) { @@ -289,8 +288,9 @@ void SfxObjectShell::UpdateTime_Impl( // If 1 or up to 31 days between now and last editing - calculate time indirectly. // nAddTime = (24h - nTime) + (nDays * 24h) + aNow + tools::Time n24Time (24,0,0,0); // Time-value for 24 hours --nDays; - nAddTime = tools::Time( nDays * n24Time.GetTime()); + nAddTime.MakeTimeFromNS(nDays * n24Time.GetNSFromTime()); nAddTime += n24Time-static_cast<const tools::Time&>(pImpl->nTime); nAddTime += aNow ; } diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index b2620b5a49e6..a5bffbd9dcbd 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2080,7 +2080,7 @@ bool HTMLParser::ParseMetaOptionsImpl( if (valid) { Date aDate(nDate); - tools::Time aTime(nTime); + tools::Time aTime(tools::Time::fromEncodedTime(nTime)); uDT = DateTime(aDate, aTime).GetUNODateTime(); } } diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 1657bdd53c04..66d00c9e7ecb 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -173,7 +173,7 @@ void SvxRedlinTable::UpdateFilterTest() Date aDateMax( Date::SYSTEM ); aDateMax.AddYears(100); Date aDateMin(1,1,1989); - tools::Time aTMin(0); + tools::Time aTMin(tools::Time::EMPTY); tools::Time aTMax(23,59,59); DateTime aDTMin(aDateMin); @@ -947,7 +947,7 @@ IMPL_LINK(SvxTPFilter, ModifyDate, SvtCalendarBox&, rTF, void) IMPL_LINK(SvxTPFilter, ModifyTime, weld::FormattedSpinButton&, rTF, void) { - tools::Time aTime(0); + tools::Time aTime(tools::Time::EMPTY); if (m_xTfDate.get() == &rTF) { if (m_xTfDate->get_text().isEmpty()) diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 71096d5758b0..1e69003f03b5 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -486,8 +486,8 @@ public: virtual std::unique_ptr<SwField> Copy() const override; const DateTime& GetDateTime() const { return m_aDateTime; } - Date GetDate() const { return Date(m_aDateTime.GetDate()); } - tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); } + Date GetDate() const { return Date(m_aDateTime); } + tools::Time GetTime() const { return tools::Time(m_aDateTime); } sal_uInt32 GetPostItId() const { return m_nPostItId; } void SetPostItId(const sal_uInt32 nPostItId = 0); void SetParentPostItId(const sal_uInt32 nParentPostItId = 0); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index d48c31b06d24..63e85da3be7e 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -1436,7 +1436,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) { bChgd = true; static_cast<SwDateTimeField*>(pFormatField->GetField())->SetDateTime( - DateTime(Date(nDate), tools::Time(nTime)) ); + DateTime(Date(nDate), tools::Time::fromEncodedTime(nTime)) ); } break; diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 6066a230fb0f..cd825c872e7c 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -245,7 +245,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, DateTime aTmplDate( DateTime::SYSTEM ); { - tools::Time a2Min( 0 ); a2Min.SetMin( 2 ); + tools::Time a2Min(0, 2); aTmplDate += a2Min; } diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index c1eff7ef7cb7..fbb3c3965dc7 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -346,7 +346,7 @@ void SwHTMLParser::NewField() nSub = TIMEFLD; pFormatTable = aHTMLTimeFieldFormatTable; if( !aValue.isEmpty() ) - nTime = static_cast<sal_uLong>(aValue.toInt32()); + nTime = static_cast<sal_uLong>(aValue.toInt32()); // Is this OK? 32-bit encoded time? } if( !aValue.isEmpty() ) nSub |= FIXEDFLD; @@ -373,7 +373,7 @@ void SwHTMLParser::NewField() xNewField.reset(new SwDateTimeField(static_cast<SwDateTimeFieldType *>(pType), nSub, nNumFormat)); if (nSub & FIXEDFLD) - static_cast<SwDateTimeField *>(xNewField.get())->SetDateTime(DateTime(Date(nDate), tools::Time(nTime))); + static_cast<SwDateTimeField *>(xNewField.get())->SetDateTime(DateTime(Date(nDate), tools::Time::fromEncodedTime(nTime))); } break; diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx b/sw/source/uibase/sidebar/CommentsPanel.cxx index ab50d9cfa439..0b8fdb6d52c0 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.cxx +++ b/sw/source/uibase/sidebar/CommentsPanel.cxx @@ -132,8 +132,8 @@ void Comment::InitControls(const SwPostItField* pPostItField) return; msText = pPostItField->GetText(); msAuthor = pPostItField->GetPar1(); - maDate = Date(pPostItField->GetDateTime().GetDate()); - maTime = tools::Time(pPostItField->GetDateTime().GetTime()); + maDate = Date(pPostItField->GetDateTime()); + maTime = tools::Time(pPostItField->GetDateTime()); mbResolved = pPostItField->GetResolved(); OUString sDate = sw::sidebar::CommentsPanel::FormatDate(maDate); @@ -351,10 +351,10 @@ bool CommentsPanel::comp_dateTime(SwFormatField* a, SwFormatField* b) SwPostItField* pA = static_cast<SwPostItField*>(a->GetField()); SwPostItField* pB = static_cast<SwPostItField*>(b->GetField()); - Date aDateA(pA->GetDateTime().GetDate()); - tools::Time aTimeA(pA->GetDateTime().GetTime()); - Date aDateB(pB->GetDateTime().GetDate()); - tools::Time aTimeB(pB->GetDateTime().GetTime()); + Date aDateA(pA->GetDateTime()); + tools::Time aTimeA(pA->GetDateTime()); + Date aDateB(pB->GetDateTime()); + tools::Time aTimeB(pB->GetDateTime()); OUString sDateTimeA = FormatTime(aTimeA) + " " + FormatDate(aDateA); OUString sDateTimeB = FormatTime(aTimeB) + " " + FormatDate(aDateB); diff --git a/tools/qa/cppunit/test_duration.cxx b/tools/qa/cppunit/test_duration.cxx index c4032be83a03..fb5e779d9030 100644 --- a/tools/qa/cppunit/test_duration.cxx +++ b/tools/qa/cppunit/test_duration.cxx @@ -28,7 +28,7 @@ public: void DurationTest::testDuration() { { - const Duration aD(Time(0), Time(12, 0, 0)); + const Duration aD(Time(Time::EMPTY), Time(12, 0, 0)); CPPUNIT_ASSERT_EQUAL(0.5, aD.GetInDays()); } { diff --git a/tools/qa/cppunit/test_time.cxx b/tools/qa/cppunit/test_time.cxx index a21f98d7b4d3..4f7ca73fe4e1 100644 --- a/tools/qa/cppunit/test_time.cxx +++ b/tools/qa/cppunit/test_time.cxx @@ -31,7 +31,7 @@ void TimeTest::testTime() Time aOrigTime(1, 56, 10); auto nMS = aOrigTime.GetMSFromTime(); - Time aNewTime(0); + Time aNewTime(tools::Time::EMPTY); aNewTime.MakeTimeFromMS(nMS); CPPUNIT_ASSERT(bool(aOrigTime == aNewTime)); diff --git a/tools/source/datetime/duration.cxx b/tools/source/datetime/duration.cxx index a655f016a1bc..a0c104105e76 100644 --- a/tools/source/datetime/duration.cxx +++ b/tools/source/datetime/duration.cxx @@ -105,7 +105,7 @@ Duration::Duration(sal_Int32 nDays, sal_uInt32 nHours, sal_uInt32 nMinutes, sal_ } Duration::Duration(sal_Int32 nDays, sal_Int64 nTime) - : maTime(nTime) + : maTime(Time::fromEncodedTime(nTime)) , mnDays(nDays) { } diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 4cef5ca5ad0f..98f6deac0177 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -171,7 +171,7 @@ bool INetMIMEMessage::ParseDateField ( else if (comphelper::string::isdigitAsciiString(aDateField)) { // Format: delta seconds. - tools::Time aDelta (0); + tools::Time aDelta(tools::Time::EMPTY); aDelta.SetTime (aDateField.toInt32() * 100); DateTime aNow( DateTime::SYSTEM ); diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index e2cc1f6d1150..110b9fa5afda 100644 --- a/unotools/source/misc/datetime.cxx +++ b/unotools/source/misc/datetime.cxx @@ -222,7 +222,7 @@ OUString GetDateTimeString(sal_Int32 _nDate, sal_Int32 _nTime) const LocaleDataWrapper& rLoDa = GetLocaleData(); Date aDate(_nDate); - tools::Time aTime(_nTime * tools::Time::nanoPerCenti); + tools::Time aTime(tools::Time::fromEncodedTime(_nTime * tools::Time::nanoPerCenti)); return rLoDa.getDate(aDate) + ", " + rLoDa.getTime(aTime); } diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 15e994e48ff3..f082b08f798d 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -3102,7 +3102,7 @@ namespace weld { tools::Time TimeFormatter::ConvertValue(int nValue) { - tools::Time aTime(0); + tools::Time aTime(tools::Time::EMPTY); aTime.MakeTimeFromMS(nValue); return aTime; } @@ -3156,7 +3156,7 @@ namespace weld { const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); - tools::Time aResult(0); + tools::Time aResult(tools::Time::EMPTY); bool bRet = ::TimeFormatter::TextToTime(GetEntryText(), aResult, m_eFormat, m_bDuration, rLocaleDataWrapper); if (bRet) *result = ConvertValue(aResult); diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index b1dba0d2b6f5..74150a1fda46 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -1069,7 +1069,7 @@ namespace xmloff sal_Int32 nRepeatDelay = 0; m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay; - tools::Time aTime( tools::Time::SYSTEM ); + tools::Time aTime(tools::Time::EMPTY); aTime.MakeTimeFromMS( nRepeatDelay ); util::Duration aDuration; aDuration.Hours = aTime.GetHour(); diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx index 6a8c2cba1a90..617025d93915 100644 --- a/xmloff/source/forms/handler/vcl_time_handler.cxx +++ b/xmloff/source/forms/handler/vcl_time_handler.cxx @@ -78,7 +78,7 @@ namespace xmloff } // legacy integer was in centiseconds nVCLTime *= ::tools::Time::nanoPerCenti; - aTime = ::tools::Time(nVCLTime).GetUNOTime(); + aTime = tools::Time::fromEncodedTime(nVCLTime).GetUNOTime(); } const Any aPropertyValue( aTime ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index e0014c26a573..fec74e7ad123 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1177,7 +1177,8 @@ bool ImportContext::importTimeProperty( _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); if (!aValue.isEmpty()) { - ::tools::Time aTTime(toInt32( aValue ) * ::tools::Time::nanoPerCenti); + // Is it really the legacy "encoded value in centiseconds"? + tools::Time aTTime(tools::Time::fromEncodedTime(toInt32(aValue) * tools::Time::nanoPerCenti)); util::Time aUTime(aTTime.GetUNOTime()); _xControlModel->setPropertyValue( rPropName, Any( aUTime ) ); return true; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 5ef8449bff08..2cd3e11e8571 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -193,12 +193,12 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP(weld::Container* pParent, DateTime aDateTime( DateTime::EMPTY ); utl::typeConvert( xCert->getNotValidBefore(), aDateTime ); - aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(Date(aDateTime.GetDate())) + " "; - aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(tools::Time(aDateTime.GetTime())); + aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(aDateTime) + " "; + aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(aDateTime); InsertElement( XsResId( STR_VALIDFROM ), aLBEntry, aLBEntry ); utl::typeConvert( xCert->getNotValidAfter(), aDateTime ); - aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(Date(aDateTime.GetDate()) ) + " "; - aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(tools::Time(aDateTime.GetTime())); + aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(aDateTime) + " "; + aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(aDateTime); InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry ); std::pair< OUString, OUString > pairSubject = |