Ignore:
Timestamp:
Mar 14, 2008, 7:59:38 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Get rid of a localime() call on platforms that have better alternatives.

  • kjs/DateMath.h: Added getLocalTime();
  • kjs/DateMath.cpp: (KJS::getLocalTime): (KJS::getDSTOffsetSimple): Implementation moved from getDSTOffsetSimple().
  • kjs/date_object.cpp: (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/DateMath.cpp

    r29663 r31057  
    293293}
    294294
     295void getLocalTime(const time_t* localTime, struct tm* localTM)
     296{
     297#if PLATFORM(QT)
     298#if USE(MULTIPLE_THREADS)
     299#error Mulitple threads are currently not supported in the Qt/mingw build
     300#endif
     301    *localTM = *localtime(localTime);
     302#elif PLATFORM(WIN_OS)
     303    #if COMPILER(MSVC7)
     304    *localTM = *localtime(localTime);
     305    #else
     306    localtime_s(localTM, localTime);
     307    #endif
     308#else
     309    localtime_r(localTime, localTM);
     310#endif
     311}
     312
    295313// There is a hard limit at 2038 that we currently do not have a workaround
    296314// for (rdar://problem/5052975).
     
    416434
    417435    tm localTM;
    418 #if PLATFORM(QT)
    419     // ### this is not threadsafe but we don't use multiple threads anyway
    420     // in the Qt build
    421 #if USE(MULTIPLE_THREADS)
    422 #error Mulitple threads are currently not supported in the Qt/mingw build
    423 #endif
    424     localTM = *localtime(&localTime);
    425 #elif PLATFORM(WIN_OS)
    426     #if COMPILER(MSVC7)
    427     localTM = *localtime(&localTime);
    428     #else
    429     localtime_s(&localTM, &localTime);
    430     #endif
    431 #else
    432     localtime_r(&localTime, &localTM);
    433 #endif
     436    getLocalTime(&localTime, &localTM);
    434437
    435438    double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
Note: See TracChangeset for help on using the changeset viewer.