Ignore:
Timestamp:
Apr 28, 2010, 2:02:13 PM (15 years ago)
Author:
Darin Adler
Message:

Don't use CFAbsoluteTimeGetCurrent on Mac OS X, since it's just a cover
for gettimeofday anyway.

Reviewed by Sam Weinig.

  • wtf/CurrentTime.cpp:

(WTF::currentTime): Remove the CF version of this. Change the "other POSIX"
version to pass 0 for the time zone instead of ignoring a return value.
Also get rid of unneeded type casts, since operations involving both
integers and doubles are always evaluated as doubles in C without explicit
type casting.

File:
1 edited

Legend:

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

    r54183 r58429  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Google Inc. All rights reserved.
    44 * Copyright (C) 2007-2009 Torch Mobile, Inc.
     
    5454#endif
    5555
    56 #elif PLATFORM(CF)
    57 #include <CoreFoundation/CFDate.h>
    5856#elif PLATFORM(GTK)
    5957#include <glib.h>
     
    6260#elif PLATFORM(BREWMP)
    6361#include <AEEStdLib.h>
    64 #else // Posix systems relying on the gettimeofday()
     62#else
    6563#include <sys/time.h>
    6664#endif
     
    252250#endif // USE(QUERY_PERFORMANCE_COUNTER)
    253251
    254 #elif PLATFORM(CF)
    255 
    256 double currentTime()
    257 {
    258     return CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970;
    259 }
    260 
    261252#elif PLATFORM(GTK)
    262253
     
    294285}
    295286
    296 #else // Other Posix systems rely on the gettimeofday().
     287#else
    297288
    298289double currentTime()
    299290{
    300291    struct timeval now;
    301     struct timezone zone;
    302 
    303     gettimeofday(&now, &zone);
    304     return static_cast<double>(now.tv_sec) + (double)(now.tv_usec / 1000000.0);
     292    gettimeofday(&now, 0);
     293    return now.tv_sec + now.tv_usec / 1000000.0;
    305294}
    306295
Note: See TracChangeset for help on using the changeset viewer.