1. coloured buttons seem to work

2. wxDateTime::ParseFormat() starts to work


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-12-22 00:16:02 +00:00
parent 5f287370dd
commit be4017f89b
5 changed files with 92 additions and 38 deletions

View File

@@ -791,6 +791,15 @@ public:
// returns TRUE if the date is in the given range
inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
// do these two objects refer to the same date?
inline bool IsSameDate(const wxDateTime& dt) const;
// do these two objects have the same time?
inline bool IsSameTime(const wxDateTime& dt) const;
// are these two objects equal up to given timespan?
inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
// arithmetics with dates (see also below for more operators)
// ------------------------------------------------------------------------

View File

@@ -16,6 +16,8 @@
#error "This file is only included by wx/datetime.h, don't include it manually!"
#endif
#define MILLISECONDS_PER_DAY 86400000l
// ----------------------------------------------------------------------------
// wxDateTime construction
// ----------------------------------------------------------------------------
@@ -169,6 +171,32 @@ bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const
return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2);
}
bool wxDateTime::IsSameDate(const wxDateTime& dt) const
{
return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY;
}
bool wxDateTime::IsSameTime(const wxDateTime& dt) const
{
// notice that we can't do something like this:
//
// m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
//
// because we have also to deal with (possibly) different DST settings!
Tm tm1 = GetTm(),
tm2 = dt.GetTm();
return tm1.hour == tm2.hour &&
tm1.min == tm2.min &&
tm1.sec == tm2.sec &&
tm1.msec == tm2.msec;
}
bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const
{
return IsBetween(dt.Substract(ts), dt.Add(ts));
}
// ----------------------------------------------------------------------------
// wxDateTime arithmetics
// ----------------------------------------------------------------------------
@@ -401,3 +429,4 @@ wxDateSpan& wxDateSpan::Neg()
return *this;
}
#undef MILLISECONDS_PER_DAY