1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Miscellaneous time-related functions.
4 // Author: Vadim Zeitlin
6 // RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
14 #include "wx/longlong.h"
16 // Returns the difference between UTC and local time in seconds.
17 WXDLLIMPEXP_BASE
int wxGetTimeZone();
19 // Get number of seconds since local time 00:00:00 Jan 1st 1970.
20 extern long WXDLLIMPEXP_BASE
wxGetLocalTime();
22 // Get number of seconds since GMT 00:00:00, Jan 1st 1970.
23 extern long WXDLLIMPEXP_BASE
wxGetUTCTime();
26 typedef wxLongLong wxMilliClock_t
;
27 inline long wxMilliClockToLong(wxLongLong ll
) { return ll
.ToLong(); }
29 typedef double wxMilliClock_t
;
30 inline long wxMilliClockToLong(double d
) { return wx_truncate_cast(long, d
); }
31 #endif // wxUSE_LONGLONG
33 // Get number of milliseconds since local time 00:00:00 Jan 1st 1970
34 extern wxMilliClock_t WXDLLIMPEXP_BASE
wxGetLocalTimeMillis();
38 // Get the number of milliseconds or microseconds since the Epoch.
39 wxLongLong WXDLLIMPEXP_BASE
wxGetUTCTimeMillis();
40 wxLongLong WXDLLIMPEXP_BASE
wxGetUTCTimeUSec();
42 #endif // wxUSE_LONGLONG
44 #define wxGetCurrentTime() wxGetLocalTime()
46 // on some really old systems gettimeofday() doesn't have the second argument,
47 // define wxGetTimeOfDay() to hide this difference
48 #ifdef HAVE_GETTIMEOFDAY
49 #ifdef WX_GETTIMEOFDAY_NO_TZ
50 #define wxGetTimeOfDay(tv) gettimeofday(tv)
52 #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL)
54 #endif // HAVE_GETTIMEOFDAY