- assertArgSpecies(ob,classDesc,"compare");
- register clockTy t = castdown(ob).sec;
- if (sec < t) return -1;
- if (sec > t) return 1;
- return 0;
-}
-
-void wxTime::deepenShallowCopy() {}
-
-unsigned wxTime::hash() const { return sec; }
-
-bool wxTime::isEqual(const Object& ob) const
+#ifdef WX_GMTOFF_IN_TM
+ // set to true when the timezone is set
+ static bool s_timezoneSet = false;
+ static long gmtoffset = LONG_MAX; // invalid timezone
+
+ // ensure that the timezone variable is set by calling wxLocaltime_r
+ if ( !s_timezoneSet )
+ {
+ // just call wxLocaltime_r() instead of figuring out whether this
+ // system supports tzset(), _tzset() or something else
+ time_t t = time(NULL);
+ struct tm tm;
+
+ wxLocaltime_r(&t, &tm);
+ s_timezoneSet = true;
+
+ // note that GMT offset is the opposite of time zone and so to return
+ // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM
+ // cases we have to negate it
+ gmtoffset = -tm.tm_gmtoff;
+
+ // this function is supposed to return the same value whether DST is
+ // enabled or not, so we need to use an additional offset if DST is on
+ // as tm_gmtoff already does include it
+ if ( tm.tm_isdst )
+ gmtoffset += 3600;
+ }
+ return (int)gmtoffset;
+#elif defined(__DJGPP__) || defined(__WINE__)
+ struct timeb tb;
+ ftime(&tb);
+ return tb.timezone*60;
+#elif defined(__VISUALC__)
+ // We must initialize the time zone information before using it (this will
+ // be done only once internally).
+ _tzset();
+
+ // Starting with VC++ 8 timezone variable is deprecated and is not even
+ // available in some standard library version so use the new function for
+ // accessing it instead.
+ #if wxCHECK_VISUALC_VERSION(8)
+ long t;
+ _get_timezone(&t);
+ return t;
+ #else // VC++ < 8
+ return timezone;
+ #endif
+#else // Use some kind of time zone variable.
+ // In any case we must initialize the time zone before using it.
+ tzset();
+
+ #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it.
+ return WX_TIMEZONE;
+ #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
+ return _timezone;
+ #elif defined(__MWERKS__)
+ // This is just plain wrong but apparently MetroWerks runtime didn't have
+ // any way to get the time zone.
+ return 28800;
+ #else // unknown platform -- assume it has timezone
+ return timezone;
+ #endif // different time zone variables
+#endif // different ways to determine time zone
+}
+
+// Get local time as seconds since 00:00:00, Jan 1st 1970
+long wxGetLocalTime()