even more wxDateTime work (completely broken for now, but support for the

full date range almost finished)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-12-02 01:01:26 +00:00
parent f151e8b583
commit e6ec579c77
4 changed files with 350 additions and 41 deletions

View File

@@ -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") );
@@ -257,7 +262,7 @@ wxDateTime wxDateTime::ToLocalTime(const wxDateTime::TimeZone& tz) const
}
// ----------------------------------------------------------------------------
// wxTimeSpan
// wxTimeSpan construction
// ----------------------------------------------------------------------------
wxTimeSpan::wxTimeSpan(int hours, int minutes, int seconds, int milliseconds)
@@ -272,6 +277,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();