Added wxGetUTCTimeMillis() and wxGetUTCTimeUSec().

Fixed wxGetLocalTimeMillis() to really return the local time and provide
wxGetUTCTimeMillis() doing what this function used to do before. Closes #13610.

Also add wxGetUTCTimeUSec() for even higher resolution time stamps as it is
basically the same as wxGetUTCTimeMillis() anyhow, at least for MSW and
non-ancient Unix systems providing gettimeofday().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-11-27 19:50:23 +00:00
parent 59068d79f7
commit a43503cb8d
4 changed files with 85 additions and 53 deletions

View File

@@ -1,10 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/stopwatch.h
// Purpose: wxStopWatch and global time-related functions
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch)
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch),
// Vadim Zeitlin (time functions, current wxStopWatch)
// Created: 26.06.03 (extracted from wx/timer.h)
// RCS-ID: $Id$
// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux
// (c) 2011 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -14,6 +16,11 @@
#include "wx/defs.h"
#include "wx/longlong.h"
// Time-related functions are also available via this header for compatibility
// but you should include wx/time.h directly if you need only them and not
// wxStopWatch itself.
#include "wx/time.h"
// ----------------------------------------------------------------------------
// wxStopWatch: measure time intervals with up to 1ms resolution
// ----------------------------------------------------------------------------
@@ -116,6 +123,14 @@ extern long WXDLLIMPEXP_BASE wxGetUTCTime();
// Get number of milliseconds since local time 00:00:00 Jan 1st 1970
extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis();
#if wxUSE_LONGLONG
// Get the number of milliseconds or microseconds since the Epoch.
wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis();
wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec();
#endif // wxUSE_LONGLONG
#define wxGetCurrentTime() wxGetLocalTime()
// on some really old systems gettimeofday() doesn't have the second argument,