diff options
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp index b36cae5..30ca7c3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp @@ -33,7 +33,7 @@ #include "config.h" #include "CurrentTime.h" -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) // Windows is first since we want to use hires timers, despite PLATFORM(CF) // being defined. @@ -45,7 +45,7 @@ #include <time.h> #if USE(QUERY_PERFORMANCE_COUNTER) -#if PLATFORM(WINCE) +#if OS(WINCE) extern "C" time_t mktime(struct tm *t); #else #include <sys/timeb.h> @@ -59,6 +59,8 @@ extern "C" time_t mktime(struct tm *t); #include <glib.h> #elif PLATFORM(WX) #include <wx/datetime.h> +#elif PLATFORM(BREWMP) +#include <AEEStdLib.h> #else // Posix systems relying on the gettimeofday() #include <sys/time.h> #endif @@ -71,7 +73,7 @@ namespace WTF { const double msPerSecond = 1000.0; -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #if USE(QUERY_PERFORMANCE_COUNTER) @@ -123,7 +125,7 @@ static double highResUpTime() static double lowResUTCTime() { -#if PLATFORM(WINCE) +#if OS(WINCE) SYSTEMTIME systemTime; GetSystemTime(&systemTime); struct tm tmtime; @@ -277,6 +279,20 @@ double currentTime() return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); } +#elif PLATFORM(BREWMP) + +// GETUTCSECONDS returns the number of seconds since 1980/01/06 00:00:00 UTC, +// and GETTIMEMS returns the number of milliseconds that have elapsed since the last +// occurrence of 00:00:00 local time. +// We can combine GETUTCSECONDS and GETTIMEMS to calculate the number of milliseconds +// since 1970/01/01 00:00:00 UTC. +double currentTime() +{ + // diffSeconds is the number of seconds from 1970/01/01 to 1980/01/06 + const unsigned diffSeconds = 315964800; + return static_cast<double>(diffSeconds + GETUTCSECONDS() + ((GETTIMEMS() % 1000) / msPerSecond)); +} + #else // Other Posix systems rely on the gettimeofday(). double currentTime() |