- wxLongLong val = 1000l;
-
- // If possible, use a function which avoids conversions from
- // broken-up time structures to milliseconds
-
-#if defined(__WXMSW__) && defined(__MWERKS__)
- // This should probably be the way all WXMSW compilers should do it
- // Go direct to the OS for time
-
- SYSTEMTIME thenst = { 1970, 1, 4, 1, 0, 0, 0, 0 }; // 00:00:00 Jan 1st 1970
- FILETIME thenft;
- SystemTimeToFileTime( &thenst, &thenft );
- wxLongLong then( thenft.dwHighDateTime, thenft.dwLowDateTime ); // time in 100 nanoseconds
-
- SYSTEMTIME nowst;
- GetLocalTime( &nowst );
- FILETIME nowft;
- SystemTimeToFileTime( &nowst, &nowft );
- wxLongLong now( nowft.dwHighDateTime, nowft.dwLowDateTime ); // time in 100 nanoseconds
-
- return ( now - then ) / 10000.0; // time from 00:00:00 Jan 1st 1970 to now in milliseconds
-
-#elif defined(HAVE_GETTIMEOFDAY)
- struct timeval tp;
- if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 )
- {
- val *= tp.tv_sec;
- return (val + (tp.tv_usec / 1000));
- }
- else
- {
- wxLogError(_("wxGetTimeOfDay failed."));
- return 0;
- }
-#elif defined(HAVE_FTIME)
- struct timeb tp;
-
- // ftime() is void and not int in some mingw32 headers, so don't
- // test the return code (well, it shouldn't fail anyhow...)
- (void)ftime(&tp);
- val *= tp.time;
- return (val + tp.millitm);
-#elif defined(__WXMAC__)
-
- static UInt64 gMilliAtStart = 0;