Ignore:
Timestamp:
Feb 1, 2010, 5:33:52 PM (15 years ago)
Author:
[email protected]
Message:

2010-02-01 Kwang Yul Seo <[email protected]>

Reviewed by Eric Seidel.

[BREWMP] Port WTF's currentTime
https://bugs.webkit.org/show_bug.cgi?id=33567

Combine GETUTCSECONDS and GETTIMEMS to calculate the number
of milliseconds since 1970/01/01 00:00:00 UTC.

  • wtf/CurrentTime.cpp: (WTF::currentTime):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/CurrentTime.cpp

    r52791 r54183  
    6060#elif PLATFORM(WX)
    6161#include <wx/datetime.h>
     62#elif PLATFORM(BREWMP)
     63#include <AEEStdLib.h>
    6264#else // Posix systems relying on the gettimeofday()
    6365#include <sys/time.h>
     
    278280}
    279281
     282#elif PLATFORM(BREWMP)
     283
     284// GETUTCSECONDS returns the number of seconds since 1980/01/06 00:00:00 UTC,
     285// and GETTIMEMS returns the number of milliseconds that have elapsed since the last
     286// occurrence of 00:00:00 local time.
     287// We can combine GETUTCSECONDS and GETTIMEMS to calculate the number of milliseconds
     288// since 1970/01/01 00:00:00 UTC.
     289double currentTime()
     290{
     291    // diffSeconds is the number of seconds from 1970/01/01 to 1980/01/06
     292    const unsigned diffSeconds = 315964800;
     293    return static_cast<double>(diffSeconds + GETUTCSECONDS() + ((GETTIMEMS() % 1000) / msPerSecond));
     294}
     295
    280296#else // Other Posix systems rely on the gettimeofday().
    281297
Note: See TracChangeset for help on using the changeset viewer.