From: Sylvain Bougnoux Date: Wed, 16 Feb 2000 13:38:50 +0000 (+0000) Subject: Fixed stupidity X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0158f58424124c608703e1325f623a3473f3baa6?ds=sidebyside Fixed stupidity git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index 4cb3e51b17..3d8db4c936 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -230,11 +230,21 @@ long wxGetUTCTime() // Get local time as milliseconds since 00:00:00, Jan 1st 1970 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 // 00:00:00 Jan 1st 1970 and then whatever is available // to get millisecond resolution. - // - wxLongLong val = 1000l; + // THIS LEADS TO A BUG SINCE REFERENCE TIME ARE DIFFERENT val *= wxGetLocalTime(); // If we got here, do not fail even if we can't get @@ -248,21 +258,13 @@ wxLongLong wxGetLocalTimeMillis() DATETIME dt; ::DosGetDateTime(&dt); 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) struct timeb tp; if ( ftime(&tp) == 0 ) { return (val + tp.millitm); } -#else -#if !defined(__BORLANDC__) && !(defined(__VISUALC__) && defined(__WIN16__)) +#elif !defined(__BORLANDC__) && !(defined(__VISUALC__) && defined(__WIN16__)) #warning "wxStopWatch will be up to second resolution!" #endif #endif