Fixed stupidity
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -230,11 +230,21 @@ long wxGetUTCTime()
|
|||||||
// Get local time as milliseconds since 00:00:00, Jan 1st 1970
|
// Get local time as milliseconds since 00:00:00, Jan 1st 1970
|
||||||
wxLongLong wxGetLocalTimeMillis()
|
wxLongLong wxGetLocalTimeMillis()
|
||||||
{
|
{
|
||||||
|
wxLongLong val = 1000l;
|
||||||
|
|
||||||
|
#if defined(HAVE_GETTIMEOFDAY)
|
||||||
|
struct timeval tp;
|
||||||
|
if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 )
|
||||||
|
{
|
||||||
|
val *= tp.tv_sec;
|
||||||
|
return (val + (tp.tv_usec / 1000));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
// We use wxGetLocalTime() to get the seconds since
|
// We use wxGetLocalTime() to get the seconds since
|
||||||
// 00:00:00 Jan 1st 1970 and then whatever is available
|
// 00:00:00 Jan 1st 1970 and then whatever is available
|
||||||
// to get millisecond resolution.
|
// to get millisecond resolution.
|
||||||
//
|
// THIS LEADS TO A BUG SINCE REFERENCE TIME ARE DIFFERENT
|
||||||
wxLongLong val = 1000l;
|
|
||||||
val *= wxGetLocalTime();
|
val *= wxGetLocalTime();
|
||||||
|
|
||||||
// If we got here, do not fail even if we can't get
|
// If we got here, do not fail even if we can't get
|
||||||
@@ -248,21 +258,13 @@ wxLongLong wxGetLocalTimeMillis()
|
|||||||
DATETIME dt;
|
DATETIME dt;
|
||||||
::DosGetDateTime(&dt);
|
::DosGetDateTime(&dt);
|
||||||
return (val + dt.hundredths*10);
|
return (val + dt.hundredths*10);
|
||||||
#elif defined(HAVE_GETTIMEOFDAY)
|
|
||||||
struct timeval tp;
|
|
||||||
if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 )
|
|
||||||
{
|
|
||||||
val *= tp.tv_sec;
|
|
||||||
return (val + (tp.tv_usec / 1000));
|
|
||||||
}
|
|
||||||
#elif defined(HAVE_FTIME)
|
#elif defined(HAVE_FTIME)
|
||||||
struct timeb tp;
|
struct timeb tp;
|
||||||
if ( ftime(&tp) == 0 )
|
if ( ftime(&tp) == 0 )
|
||||||
{
|
{
|
||||||
return (val + tp.millitm);
|
return (val + tp.millitm);
|
||||||
}
|
}
|
||||||
#else
|
#elif !defined(__BORLANDC__) && !(defined(__VISUALC__) && defined(__WIN16__))
|
||||||
#if !defined(__BORLANDC__) && !(defined(__VISUALC__) && defined(__WIN16__))
|
|
||||||
#warning "wxStopWatch will be up to second resolution!"
|
#warning "wxStopWatch will be up to second resolution!"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user