X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fcc3d7cbadcd59d6a2cafafc32624e8a22af0e56..d5e295970c3c7e0da478425c59cc176a5cfb71d8:/include/wx/datetime.inl?ds=sidebyside diff --git a/include/wx/datetime.inl b/include/wx/datetime.inl index 57555e6355..5b1d4652e3 100644 --- a/include/wx/datetime.inl +++ b/include/wx/datetime.inl @@ -75,6 +75,11 @@ wxDateTime::wxDateTime(const Tm& tm) Set(tm); } +wxDateTime::wxDateTime(double jdn) +{ + Set(jdn); +} + wxDateTime& wxDateTime::Set(const Tm& tm) { wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); @@ -241,23 +246,13 @@ wxDateTime& wxDateTime::operator+=(const wxDateSpan& 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 construction // ---------------------------------------------------------------------------- wxTimeSpan::wxTimeSpan(int hours, int minutes, int seconds, int milliseconds) @@ -272,6 +267,39 @@ wxTimeSpan::wxTimeSpan(int hours, int minutes, int seconds, int milliseconds) m_diff += milliseconds; } +// ---------------------------------------------------------------------------- +// wxTimeSpan accessors +// ---------------------------------------------------------------------------- + +wxLongLong wxTimeSpan::GetSeconds() const +{ + return m_diff / 1000l; +} + +int wxTimeSpan::GetMinutes() const +{ + return (GetSeconds() / 60l).GetLo(); +} + +int wxTimeSpan::GetHours() const +{ + return GetMinutes() / 60; +} + +int wxTimeSpan::GetDays() const +{ + return GetHours() / 24; +} + +int wxTimeSpan::GetWeeks() const +{ + return GetDays() / 7; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan arithmetics +// ---------------------------------------------------------------------------- + wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) { m_diff += diff.GetValue();