]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/datetime.inl
added MSLU reference to wxUSE_UNICODE
[wxWidgets.git] / include / wx / datetime.inl
index 302d65c1957a7c57e17405f99a690b8f2abaab94..398b02828b0e3841d5b3343aa71bc50cfb62c2dc 100644 (file)
@@ -54,19 +54,19 @@ inline wxDateTime wxDateTime::Now()
 /* static */
 inline wxDateTime wxDateTime::Today()
 {
-    struct tm *tm = GetTmNow();
-    tm->tm_hour =
-    tm->tm_min =
-    tm->tm_sec = 0;
+    struct tm *time = GetTmNow();
+    time->tm_hour = 0;
+    time->tm_min = 0;
+    time->tm_sec = 0;
 
-    return wxDateTime(*tm);
+    return wxDateTime(*time);
 }
 
 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
 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;
@@ -146,7 +146,7 @@ inline time_t wxDateTime::GetTicks() const
         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,
@@ -156,7 +156,8 @@ inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
     return SetToWeekDay(weekday, -1, month, year);
 }
 
-inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
+inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday,
+                                                   WeekFlags flags) const
 {
     MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
 }
@@ -191,11 +192,12 @@ inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
 }
 
 inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek,
-                                      WeekDay weekday) const
+                                      WeekDay weekday,
+                                      WeekFlags flags) const
 {
     wxDateTime dt(*this);
 
-    return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime;
+    return dt.SetToTheWeek(numWeek, weekday, flags) ? dt : wxInvalidDateTime;
 }
 
 inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
@@ -249,7 +251,12 @@ inline bool wxDateTime::IsBetween(const wxDateTime& t1,
 
 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