1. more wxDateTime work
2. some thread corrections (not fixing the deadlock with Delete() :-( ) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4791 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,7 +35,7 @@ wxDateTime::Country wxDateTime::GetCountry()
|
||||
const unsigned int wxDateTime::TIME_T_FACTOR = 1000;
|
||||
#endif // wxDEFINE_TIME_CONSTANTS
|
||||
|
||||
wxDateTime::IsInStdRange() const
|
||||
bool wxDateTime::IsInStdRange() const
|
||||
{
|
||||
return m_time >= 0l && (m_time / (long)TIME_T_FACTOR) < LONG_MAX;
|
||||
}
|
||||
@@ -237,10 +237,41 @@ wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
|
||||
return Add(diff);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDateTime and timezones
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDateTime wxDateTime::ToUTC() const
|
||||
{
|
||||
return wxDateTime(*this).MakeUTC();
|
||||
}
|
||||
|
||||
wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz) const
|
||||
{
|
||||
return wxDateTime(*this).MakeTimezone(tz);
|
||||
}
|
||||
|
||||
wxDateTime wxDateTime::ToLocalTime(const wxDateTime::TimeZone& tz) const
|
||||
{
|
||||
return wxDateTime(*this).MakeLocalTime(tz);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimeSpan
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxTimeSpan::wxTimeSpan(int hours, int minutes, int seconds, int milliseconds)
|
||||
{
|
||||
// assign first to avoid precision loss
|
||||
m_diff = hours;
|
||||
m_diff *= 60;
|
||||
m_diff += minutes;
|
||||
m_diff *= 60;
|
||||
m_diff += seconds;
|
||||
m_diff *= 1000;
|
||||
m_diff += milliseconds;
|
||||
}
|
||||
|
||||
wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
|
||||
{
|
||||
m_diff += diff.GetValue();
|
||||
@@ -325,4 +356,3 @@ wxDateSpan& wxDateSpan::Neg()
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user