diff options
author | Eike Rathke <erack@redhat.com> | 2011-12-01 21:03:42 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-12-01 21:04:29 +0100 |
commit | 86adb5cacb4fe3e7fb869299447da5876f0da30d (patch) | |
tree | f7998dd1a12a82ca53a4fa155cdf5536ac25ef62 /tools | |
parent | b20ea84970fb8b3068880a361822941c47f50edd (diff) |
get rid of class Date and Time default ctor with system time penalty
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/date.hxx | 15 | ||||
-rw-r--r-- | tools/inc/tools/datetime.hxx | 14 | ||||
-rw-r--r-- | tools/inc/tools/time.hxx | 15 | ||||
-rw-r--r-- | tools/source/datetime/tdate.cxx | 2 | ||||
-rw-r--r-- | tools/source/datetime/ttime.cxx | 2 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 6 |
6 files changed, 46 insertions, 8 deletions
diff --git a/tools/inc/tools/date.hxx b/tools/inc/tools/date.hxx index e0cb2a25ff39..71cc65f3b4ad 100644 --- a/tools/inc/tools/date.hxx +++ b/tools/inc/tools/date.hxx @@ -50,7 +50,20 @@ private: sal_uInt32 nDate; public: - Date(); + + enum DateInitSystem + { + SYSTEM + }; + // temporary until all uses are inspected and resolved + enum DateInitEmpty + { + EMPTY + }; + + Date( DateInitEmpty) + { nDate = 0; } + Date( DateInitSystem ); Date( const ResId & rResId ); Date( sal_uInt32 _nDate ) { Date::nDate = _nDate; } Date( const Date& rDate ) diff --git a/tools/inc/tools/datetime.hxx b/tools/inc/tools/datetime.hxx index d12a276d0f03..3f3ba3831d84 100644 --- a/tools/inc/tools/datetime.hxx +++ b/tools/inc/tools/datetime.hxx @@ -40,7 +40,19 @@ class TOOLS_DLLPUBLIC DateTime : public Date, public Time { public: - DateTime() : Date(), Time() {} + + enum DateTimeInitSystem + { + SYSTEM + }; + // temporary until all uses are inspected and resolved + enum DateTimeInitEmpty + { + EMPTY + }; + + DateTime( DateTimeInitEmpty ) : Date( Date::EMPTY ), Time( Time::EMPTY ) {} + DateTime( DateTimeInitSystem ) : Date( Date::SYSTEM ), Time( Time::SYSTEM ) {} DateTime( const DateTime& rDateTime ) : Date( rDateTime ), Time( rDateTime ) {} DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} diff --git a/tools/inc/tools/time.hxx b/tools/inc/tools/time.hxx index ff6a7c97b9a7..e71fca848829 100644 --- a/tools/inc/tools/time.hxx +++ b/tools/inc/tools/time.hxx @@ -49,7 +49,20 @@ private: sal_Int32 nTime; public: - Time(); + + enum TimeInitSystem + { + SYSTEM + }; + // temporary until all uses are inspected and resolved + enum TimeInitEmpty + { + EMPTY + }; + + Time( TimeInitEmpty ) + { nTime = 0; } + Time( TimeInitSystem ); Time( const ResId & rResId ); Time( sal_Int32 _nTime ) { Time::nTime = _nTime; } Time( const Time& rTime ); diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 5deef5250b24..c9614d2de759 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -137,7 +137,7 @@ static void DaysToDate( long nDays, // ======================================================================= -Date::Date() +Date::Date( DateInitSystem ) { #if defined WNT SYSTEMTIME aDateTime; diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 13f68fb2d4f4..015ab374760c 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -86,7 +86,7 @@ static Time Sec100ToTime( sal_Int32 nSec100 ) // ======================================================================= -Time::Time() +Time::Time( TimeInitSystem ) { #if defined( WNT ) SYSTEMTIME aDateTime; diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index e0db5949e08e..f5fa071ad15a 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -398,7 +398,7 @@ sal_Bool INetRFC822Message::ParseDateField ( sal_uInt16 nOffset = ParseNumber (aDateField, nIndex); if (nOffset > 0) { - Time aDiff; + Time aDiff( Time::EMPTY ); aDiff.SetHour (nOffset / 100); aDiff.SetMin (nOffset % 100); aDiff.SetSec (0); @@ -418,7 +418,7 @@ sal_Bool INetRFC822Message::ParseDateField ( Time aDelta (0); aDelta.SetTime (aDateField.toInt32() * 100); - DateTime aNow; + DateTime aNow( DateTime::SYSTEM ); aNow += aDelta; aNow.ConvertToUTC(); @@ -1112,7 +1112,7 @@ sal_Bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType) { // Generate a unique boundary from current time. sal_Char sTail[16 + 1]; - Time aCurTime; + Time aCurTime( Time::SYSTEM ); sal_uInt64 nThis = reinterpret_cast< sal_uIntPtr >( this ); // we can be on a 64bit architecture nThis = ( ( nThis >> 32 ) ^ nThis ) & SAL_MAX_UINT32; sprintf (sTail, "%08X%08X", |