From 831397aa2e07bd37291a41cd57b27ebc2cfa7fac Mon Sep 17 00:00:00 2001 From: "dglazkov@chromium.org" Date: Mon, 23 Feb 2009 17:48:25 +0000 Subject: [PATCH] 2009-02-23 Jeremy Moskovich Reviewed by Adam Roben. https://bugs.webkit.org/show_bug.cgi?id=24096 PLATFORM(MAC)->PLATFORM(CF) since we want to use the CF functions in Chrome on OS X. * wtf/CurrentTime.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41149 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- JavaScriptCore/ChangeLog | 9 ++++ JavaScriptCore/wtf/CurrentTime.cpp | 74 +++++++++++++++--------------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 68c97ab178e8..9053eb386bcd 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,12 @@ +2009-02-23 Jeremy Moskovich + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=24096 + PLATFORM(MAC)->PLATFORM(CF) since we want to use the CF functions in Chrome on OS X. + + * wtf/CurrentTime.cpp: + 2009-02-22 Geoffrey Garen Build fix? diff --git a/JavaScriptCore/wtf/CurrentTime.cpp b/JavaScriptCore/wtf/CurrentTime.cpp index f23495fa6840..c5202831195c 100644 --- a/JavaScriptCore/wtf/CurrentTime.cpp +++ b/JavaScriptCore/wtf/CurrentTime.cpp @@ -32,13 +32,9 @@ #include "config.h" #include "CurrentTime.h" -#if PLATFORM(MAC) -#include -#elif PLATFORM(GTK) -#include -#elif PLATFORM(WX) -#include -#elif PLATFORM(WIN_OS) +#if PLATFORM(WIN_OS) +// Windows is first since we want to use hires timers, despite PLATFORM(CF) +// being defined. // If defined, WIN32_LEAN_AND_MEAN disables timeBeginPeriod/timeEndPeriod. #undef WIN32_LEAN_AND_MEAN #include @@ -47,6 +43,12 @@ #include #include #include +#elif PLATFORM(CF) +#include +#elif PLATFORM(GTK) +#include +#elif PLATFORM(WX) +#include #else // Posix systems relying on the gettimeofday() #include #endif @@ -55,35 +57,7 @@ namespace WTF { const double msPerSecond = 1000.0; -#if PLATFORM(MAC) - -double currentTime() -{ - return CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970; -} - -#elif PLATFORM(GTK) - -// Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides -// better accuracy compared with Windows implementation of g_get_current_time: -// (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time). -// Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function. -double currentTime() -{ - GTimeVal now; - g_get_current_time(&now); - return static_cast(now.tv_sec) + static_cast(now.tv_usec / 1000000.0); -} - -#elif PLATFORM(WX) - -double currentTime() -{ - wxDateTime now = wxDateTime::UNow(); - return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); -} - -#elif PLATFORM(WIN_OS) +#if PLATFORM(WIN_OS) static LARGE_INTEGER qpcFrequency; static bool syncedTime; @@ -210,6 +184,34 @@ double currentTime() return utc / 1000.0; } +#elif PLATFORM(CF) + +double currentTime() +{ + return CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970; +} + +#elif PLATFORM(GTK) + +// Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides +// better accuracy compared with Windows implementation of g_get_current_time: +// (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time). +// Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function. +double currentTime() +{ + GTimeVal now; + g_get_current_time(&now); + return static_cast(now.tv_sec) + static_cast(now.tv_usec / 1000000.0); +} + +#elif PLATFORM(WX) + +double currentTime() +{ + wxDateTime now = wxDateTime::UNow(); + return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); +} + #else // Other Posix systems rely on the gettimeofday(). double currentTime() -- 2.36.0