Changeset 50183 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Oct 27, 2009, 4:29:40 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore: A little bit of refactoring in the date code.

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

  • runtime/DateConstructor.cpp:

(JSC::constructDate):

  • runtime/DateInstance.cpp:

(JSC::DateInstance::DateInstance):

  • runtime/DateInstance.h: Removed some unused functions. Changed the default

constructor to ensure that a DateInstance is always initialized.

  • runtime/DatePrototype.cpp:

(JSC::DatePrototype::DatePrototype): Pass an initializer to our constructor,
since it now requires one.

  • wtf/DateMath.cpp:

(WTF::msToGregorianDateTime): Only compute our offset from UTC if our
output will require it. Otherwise, our offset is 0.

WebKit/mac: Updated for refactoring in the date code.

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

  • WebView/WebView.mm:

(aeDescFromJSValue): Since we just want a number of milliseconds, do that
instead of something more complicated.

File:
1 edited

Legend:

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

    r49734 r50183  
    502502}
    503503
     504// input is UTC
    504505void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm)
    505506{
    506     // input is UTC
    507507    double dstOff = 0.0;
    508     const double utcOff = getUTCOffset();
    509 
    510     if (!outputIsUTC) {  // convert to local time
     508    double utcOff = 0.0;
     509    if (!outputIsUTC) {
     510        utcOff = getUTCOffset();
    511511        dstOff = getDSTOffset(ms, utcOff);
    512512        ms += dstOff + utcOff;
     
    523523    tm.year     =  year - 1900;
    524524    tm.isDST    =  dstOff != 0.0;
    525 
    526     tm.utcOffset = outputIsUTC ? 0 : static_cast<long>((dstOff + utcOff) / msPerSecond);
     525    tm.utcOffset = static_cast<long>((dstOff + utcOff) / msPerSecond);
    527526    tm.timeZone = NULL;
    528527}
Note: See TracChangeset for help on using the changeset viewer.