inline wxTimeSpan Subtract(const wxDateTime& dt) const;
inline wxTimeSpan operator-(const wxDateTime& dt2) const;
+ wxDateSpan DiffAsDateSpan(const wxDateTime& dt) const;
+
// conversion to/from text
// ------------------------------------------------------------------------
int GetYears() const { return m_years; }
// get number of months
int GetMonths() const { return m_months; }
+ // returns 12*GetYears() + GetMonths()
+ int GetTotalMonths() const { return 12*m_years + m_months; }
// get number of weeks
int GetWeeks() const { return m_weeks; }
// get number of days
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
inline wxDateTime& wxDateTime::Set(time_t timet)
{
- // assign first to avoid long multiplication overflow!
- m_time = timet - WX_TIME_BASE_OFFSET ;
- m_time *= TIME_T_FACTOR;
+ if ( timet == (time_t)-1 )
+ {
+ m_time = wxInvalidDateTime.m_time;
+ }
+ else
+ {
+ // assign first to avoid long multiplication overflow!
+ m_time = timet - WX_TIME_BASE_OFFSET;
+ m_time *= TIME_T_FACTOR;
+ }
return *this;
}