inline wxDateTime& wxDateTime::Set(time_t timet)
{
// assign first to avoid long multiplication overflow!
- m_time = timet;
+ m_time = timet - WX_TIME_BASE_OFFSET ;
m_time *= TIME_T_FACTOR;
return *this;
return (time_t)-1;
}
- return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo());
+ return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo())+WX_TIME_BASE_OFFSET ;
}
-inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
+bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
Month month,
int year)
{
inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
{
- return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY;
+ Tm tm1 = GetTm(),
+ tm2 = dt.GetTm();
+
+ return tm1.year == tm2.year &&
+ tm1.mon == tm2.mon &&
+ tm1.mday == tm2.mday;
}
inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const