]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/datetime.inl
added wxCRITICAL_SECTION macro
[wxWidgets.git] / include / wx / datetime.inl
index 3089b32111297999d0e26057bb59a5aae267aa46..8ec379dd9d2a212f961120789e83e8ed0f6d17d4 100644 (file)
@@ -54,12 +54,12 @@ 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))
@@ -149,7 +149,7 @@ inline time_t wxDateTime::GetTicks() const
     return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo())+WX_TIME_BASE_OFFSET ;
 }
 
-bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
+inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
                                          Month month,
                                          int year)
 {
@@ -249,7 +249,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