1. corrected compilation of wxTime/wxDate

2. wxDateTime::Format() seems to work (look at it to see why I'm so happy)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-12-21 15:40:13 +00:00
parent 75399efbb2
commit 68ee7c4730
6 changed files with 367 additions and 79 deletions

View File

@@ -123,7 +123,7 @@ public:
wxDate &Set(long lJulian)
{ m_date.Set((double)(lJulian + 0.5)); return (wxDate&)*this; }
wxDate &Set(int nMonth, int nDay, int nYear)
{ m_date.Set(nDay, (wxDateTime::Month)nMonth, nYear); return (wxDate&)*this; }
{ m_date.Set(nDay, (wxDateTime::Month)nMonth, nYear); return *this; }
// May also pass neg# to decrement
wxDate &AddWeeks(int nCount = 1)

View File

@@ -798,7 +798,7 @@ public:
inline wxDateTime& operator+=(const wxDateSpan& diff);
// return the difference of the date with a date span
inline wxDateTime& Substract(const wxDateSpan& diff) const;
inline wxDateTime Substract(const wxDateSpan& diff) const;
// substract a date span (positive or negative)
inline wxDateTime& Substract(const wxDateSpan& diff);
// substract a date span (positive or negative)
@@ -896,18 +896,23 @@ public:
// return the timespan for the given number of seconds
static wxTimeSpan Seconds(int sec) { return wxTimeSpan(0, 0, sec); }
static wxTimeSpan Second() { return Seconds(1); }
// return the timespan for the given number of minutes
static wxTimeSpan Minutes(int min) { return wxTimeSpan(0, min, 0 ); }
static wxTimeSpan Minute() { return Minutes(1); }
// return the timespan for the given number of hours
static wxTimeSpan Hours(int hours) { return wxTimeSpan(hours, 0, 0); }
static wxTimeSpan Hour() { return Hours(1); }
// return the timespan for the given number of days
static wxTimeSpan Days(int days) { return Hours(24 * days); }
static wxTimeSpan Day() { return Days(1); }
// return the timespan for the given number of weeks
static wxTimeSpan Weeks(int days) { return Days(7 * days); }
static wxTimeSpan Week() { return Weeks(1); }
// default ctor constructs the 0 time span
wxTimeSpan() { }
@@ -1073,15 +1078,19 @@ public:
// get an object for the given number of days
static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); }
static wxDateSpan Day() { return Days(1); }
// get an object for the given number of weeks
static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); }
static wxDateSpan Week() { return Weeks(1); }
// get an object for the given number of months
static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); }
static wxDateSpan Month() { return Months(1); }
// get an object for the given number of years
static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); }
static wxDateSpan Year() { return Years(1); }
// default copy ctor is ok

View File

@@ -222,11 +222,21 @@ wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const
return wxTimeSpan(datetime.GetValue() - GetValue());
}
wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
{
return wxDateTime(*this).Add(diff);
}
wxDateTime& wxDateTime::Substract(const wxDateSpan& diff)
{
return Add(diff.Negate());
}
wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const
{
return wxDateTime(*this).Substract(diff);
}
wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
{
return Substract(diff);