Version: 2.9.4
Functions
Time
Functions and Macros by Category

Detailed Description

The functions in this section deal with getting the current time and sleeping for the specified time interval.

Functions

int wxGetTimeZone ()
 Returns the difference between UTC and local time in seconds.
long wxGetLocalTime ()
 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
wxLongLong wxGetLocalTimeMillis ()
 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
long wxGetUTCTime ()
 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
wxLongLong wxGetUTCTimeMillis ()
 Returns the number of milliseconds since GMT 00:00:00 Jan 1st 1970.
wxLongLong wxGetUTCTimeUSec ()
 Returns the number of microseconds since GMT 00:00:00 Jan 1st 1970.
void wxMicroSleep (unsigned long microseconds)
 Sleeps for the specified number of microseconds.
void wxMilliSleep (unsigned long milliseconds)
 Sleeps for the specified number of milliseconds.
wxString wxNow ()
 Returns a string representing the current date and time.
void wxSleep (int secs)
 Sleeps for the specified number of seconds.
void wxUsleep (unsigned long milliseconds)

Function Documentation

long wxGetLocalTime ( )

Returns the number of seconds since local time 00:00:00 Jan 1st 1970.

参照:
wxDateTime::Now()

Include file:

#include <wx/time.h> 
wxLongLong wxGetLocalTimeMillis ( )

Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.

The use of wxGetUTCTimeMillis() is preferred as it provides a usually (except for changes to the system time) monotonic clock which the local time also changes whenever DST begins or ends.

参照:
wxDateTime::Now(), wxGetUTCTimeMillis(), wxGetUTCTimeUSec()

Include file:

#include <wx/time.h> 
int wxGetTimeZone ( )

Returns the difference between UTC and local time in seconds.

Include file:

#include <wx/time.h> 
long wxGetUTCTime ( )

Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.

参照:
wxDateTime::Now()

Include file:

#include <wx/time.h> 
wxLongLong wxGetUTCTimeMillis ( )

Returns the number of milliseconds since GMT 00:00:00 Jan 1st 1970.

Include file:

#include <wx/time.h> 
Since:
2.9.3
wxLongLong wxGetUTCTimeUSec ( )

Returns the number of microseconds since GMT 00:00:00 Jan 1st 1970.

Include file:

#include <wx/time.h> 
Since:
2.9.3
void wxMicroSleep ( unsigned long  microseconds)

Sleeps for the specified number of microseconds.

The microsecond resolution may not, in fact, be available on all platforms (currently only Unix platforms with nanosleep(2) may provide it) in which case this is the same as calling wxMilliSleep() with the argument of microseconds/1000.

Include file:

#include <wx/utils.h> 
void wxMilliSleep ( unsigned long  milliseconds)

Sleeps for the specified number of milliseconds.

Notice that usage of this function is encouraged instead of calling usleep(3) directly because the standard usleep() function is not MT safe.

Include file:

#include <wx/utils.h> 
wxString wxNow ( )

Returns a string representing the current date and time.

Include file:

#include <wx/utils.h> 
void wxSleep ( int  secs)

Sleeps for the specified number of seconds.

Include file:

#include <wx/utils.h> 
void wxUsleep ( unsigned long  milliseconds)
Deprecated:
This function is deprecated because its name is misleading: notice that the argument is in milliseconds, not microseconds.

Please use either wxMilliSleep() or wxMicroSleep() depending on the resolution you need.

Sleeps for the specified number of milliseconds.

Include file:

#include <wx/utils.h> 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines