Ignore:
Timestamp:
Oct 20, 2009, 2:39:43 PM (16 years ago)
Author:
[email protected]
Message:

Refactored DateInstance::msToGregorianDateTime so that a DateInstance's
caller doesn't need to supply the DateInstance's own internal value to
the DateInstance.

Patch by Geoffrey Garen <[email protected]> on 2009-10-20
Reviewed by Sam Weinig.

  • runtime/DateInstance.cpp:

(JSC::DateInstance::getGregorianDateTime): Renamed from "msToGregorianDateTime".

  • runtime/DateInstance.h:
  • runtime/DatePrototype.cpp:

(JSC::formatLocaleDate):
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear): Also renamed "utc" to "outputIsUTC", for clarity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/DateInstance.cpp

    r49217 r49886  
    6060}
    6161
    62 void DateInstance::msToGregorianDateTime(double milli, bool outputIsUTC, GregorianDateTime& t) const
     62bool DateInstance::getGregorianDateTime(bool outputIsUTC, GregorianDateTime& t) const
    6363{
    6464    if (!m_cache) {
     
    6868    }
    6969
     70    double milli = internalNumber();
     71    if (isnan(milli))
     72        return false;
     73
    7074    if (outputIsUTC) {
    7175        if (m_cache->m_gregorianDateTimeUTCCachedForMS != milli) {
    72             WTF::msToGregorianDateTime(milli, true, m_cache->m_cachedGregorianDateTimeUTC);
     76            WTF::msToGregorianDateTime(internalNumber(), true, m_cache->m_cachedGregorianDateTimeUTC);
    7377            m_cache->m_gregorianDateTimeUTCCachedForMS = milli;
    7478        }
     
    7680    } else {
    7781        if (m_cache->m_gregorianDateTimeCachedForMS != milli) {
    78             WTF::msToGregorianDateTime(milli, false, m_cache->m_cachedGregorianDateTime);
     82            WTF::msToGregorianDateTime(internalNumber(), false, m_cache->m_cachedGregorianDateTime);
    7983            m_cache->m_gregorianDateTimeCachedForMS = milli;
    8084        }
    8185        t.copyFrom(m_cache->m_cachedGregorianDateTime);
    8286    }
     87   
     88    return true;
    8389}
    8490
Note: See TracChangeset for help on using the changeset viewer.