Changeset 39866 in webkit for trunk/JavaScriptCore/wtf/CurrentTime.cpp
- Timestamp:
- Jan 13, 2009, 11:13:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/CurrentTime.cpp
r39794 r39866 35 35 #if PLATFORM(MAC) 36 36 #include <CoreFoundation/CFDate.h> 37 #elif PLATFORM(WIN) 37 #elif PLATFORM(GTK) 38 #include <glib.h> 39 #elif PLATFORM(WX) 40 #include <wx/datetime.h> 41 #elif PLATFORM(WIN_OS) 42 // If defined, WIN32_LEAN_AND_MEAN disables timeBeginPeriod/timeEndPeriod. 43 #undef WIN32_LEAN_AND_MEAN 38 44 #include <windows.h> 39 45 #include <math.h> … … 42 48 #include <sys/types.h> 43 49 #include <time.h> 44 #elif PLATFORM(GTK)45 #include <glib.h>46 #elif PLATFORM(WX)47 #include <wx/datetime.h>48 50 #else // Posix systems relying on the gettimeofday() 49 51 #include <sys/time.h> … … 61 63 } 62 64 63 #elif PLATFORM(WIN) 65 #elif PLATFORM(GTK) 66 67 // Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides 68 // better accuracy compared with Windows implementation of g_get_current_time: 69 // (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time). 70 // Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function. 71 double currentTime() 72 { 73 GTimeVal now; 74 g_get_current_time(&now); 75 return static_cast<double>(now.tv_sec) + static_cast<double>(now.tv_usec / 1000000.0); 76 } 77 78 #elif PLATFORM(WX) 79 80 double currentTime() 81 { 82 wxDateTime now = wxDateTime::UNow(); 83 return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); 84 } 85 86 #elif PLATFORM(WIN_OS) 64 87 65 88 static LARGE_INTEGER qpcFrequency; … … 188 211 } 189 212 190 #elif PLATFORM(GTK)191 192 // Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides193 // better accuracy compared with Windows implementation of g_get_current_time:194 // (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time).195 // Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function.196 double currentTime()197 {198 GTimeVal now;199 g_get_current_time(&now);200 return static_cast<double>(now.tv_sec) + static_cast<double>(now.tv_usec / 1000000.0);201 }202 203 #elif PLATFORM(WX)204 205 double currentTime()206 {207 wxDateTime now = wxDateTime::UNow();208 return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0);209 }210 211 213 #else // Other Posix systems rely on the gettimeofday(). 212 214
Note:
See TracChangeset
for help on using the changeset viewer.