Skip to content
  • barraclough@apple.com's avatar
    String(new Date(2010,10,1)) is wrong in KRAT, YAKT · d4900677
    barraclough@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=106750
    
    Reviewed by Darin Adler.
    
    First part of a fix, simplfy date handling code, instead of operating separately
    on the UTC-standard and standard-DST offsets, just generate a combined UTC-local
    offset (this is what we actually need, and what the OS gives us).
    
    ../JavaScriptCore: 
    
    * runtime/JSDateMath.cpp:
    (JSC::getLocalTimeOffset):
        - removed getUTCOffset, converted getDSTOffset -> getLocalTimeOffset
    (JSC::gregorianDateTimeToMS):
    (JSC::msToGregorianDateTime):
    (JSC::parseDateFromNullTerminatedCharacters):
        - call getLocalTimeOffset instead of getUTCOffset/getDSTOffset
    * runtime/VM.cpp:
    (JSC::VM::resetDateCache):
        - removed cachedUTCOffset, converted DSTOffsetCache -> LocalTimeOffsetCache
    * runtime/VM.h:
    (JSC::LocalTimeOffsetCache::LocalTimeOffsetCache):
    (JSC::LocalTimeOffsetCache::reset):
    (LocalTimeOffsetCache):
        - removed cachedUTCOffset, converted DSTOffsetCache -> LocalTimeOffsetCache
    
    ../WTF: 
    
    * wtf/DateMath.cpp:
    (WTF::calculateUTCOffset):
    (WTF::calculateDSTOffset):
        - made static, now not called from outside of this file.
    (WTF::calculateLocalTimeOffset):
        - This combines the 2038 related adjustment from calculateDSTOffset with the
          maxUnixTime adjustment from calculateDSTOffsetSimple. Then, if HAVE(TM_GMTOFF)
          just call getLocalTime, if not use calculateUTCOffset/calculateDSTOffset.
    (WTF::parseDateFromNullTerminatedCharacters):
        - call calculateLocalTimeOffset instead of calculateUTCOffset/calculateDSTOffset
    * wtf/DateMath.h:
    (WTF::LocalTimeOffset::LocalTimeOffset):
    (LocalTimeOffset):
    (WTF::LocalTimeOffset::operator==):
        - new struct type, a tuple of UTC-local offset & isDST flag.
        - replaced calculateUTCOffset/calculateDSTOffset with calculateLocalTimeOffset
    * wtf/GregorianDateTime.cpp:
    (WTF::GregorianDateTime::setToCurrentLocalTime):
        - call calculateLocalTimeOffset instead of calculateUTCOffset/calculateDSTOffset
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d4900677