- bool IsDST() const;
- wxTime GetLocalTime() const;
-private: // static member functions
- static wxTime GetLocalTime(const wxDate& date, hourTy h=0, minuteTy m=0, secondTy s=0);
- static wxTime GetBeginDST(unsigned year);
- static wxTime GetEndDST(unsigned year);
-public:
- wxTime(); // current time
- wxTime(clockTy s) { sec = s; }
- wxTime(const wxTime& t) { (*this) = t ; }
- wxTime(hourTy h, minuteTy m, secondTy s =0, bool dst =FALSE);
- wxTime(const wxDate&, hourTy h =0, minuteTy m =0, secondTy s=0, bool dst =FALSE);
- // Convert to string
- operator char * (void);
- operator wxDate() const;
- bool operator<(const wxTime& t) const { return sec < t.sec; }
- bool operator<=(const wxTime& t) const { return sec <= t.sec; }
- bool operator>(const wxTime& t) const { return sec > t.sec; }
- bool operator>=(const wxTime& t) const { return sec >= t.sec; }
- bool operator==(const wxTime& t) const { return sec == t.sec; }
- bool operator!=(const wxTime& t) const { return sec != t.sec; }
- void operator=(const wxTime& t) { sec = t.sec; }
- friend wxTime operator+(const wxTime& t, long s) { return wxTime(t.sec+s); }
- friend wxTime operator+(long s, const wxTime& t) { return wxTime(t.sec+s); }
- long operator-(const wxTime& t) const { return sec - t.sec; }
- wxTime operator-(long s) const { return wxTime(sec-s); }
- void operator+=(long s) { sec += s; }
- void operator-=(long s) { sec -= s; }
- bool IsBetween(const wxTime& a, const wxTime& b) const;
- hourTy GetHour() const; // hour in local time
- hourTy GetHourGMT() const; // hour in GMT
- minuteTy GetMinute() const; // minute in local time
- minuteTy GetMinuteGMT() const; // minute in GMT
- secondTy GetSecond() const; // second in local time or GMT
- clockTy GetSeconds() const { return sec; }
- wxTime Max(const wxTime&) const;
- wxTime Min(const wxTime&) const;
- static void SetFormat(const tFormat lFormat = wx12h,
- const tPrecision lPrecision = wxStdMinSec);
- char *FormatTime() const;
-/*
- virtual int compare(const Object&) const;
- virtual void deepenShallowCopy(); // {}
- virtual unsigned hash() const;
- virtual bool isEqual(const Object&) const;
- virtual void printOn(ostream& strm =cout) const;
- virtual const Class* species() const;
-*/
-};
+// on some really old systems gettimeofday() doesn't have the second argument,
+// define wxGetTimeOfDay() to hide this difference
+#ifdef HAVE_GETTIMEOFDAY
+ #ifdef WX_GETTIMEOFDAY_NO_TZ
+ #define wxGetTimeOfDay(tv) gettimeofday(tv)
+ #else
+ #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL)
+ #endif
+#endif // HAVE_GETTIMEOFDAY
+
+/* Two wrapper functions for thread safety */
+#ifdef HAVE_LOCALTIME_R
+#define wxLocaltime_r localtime_r
+#else
+WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*);
+#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__)
+ // On Windows, localtime _is_ threadsafe!
+#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r
+#endif
+#endif