Changeset 17031 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 13, 2006, 10:31:11 AM (19 years ago)
Author:
kmccullo
Message:

Reviewed by Adam, Geoff, Darin.

Fixed displaying the UTC offset and time zone string, as well as renamed the GregorianDateTime structure and clean up.

  • ChangeLog:
  • kjs/DateMath.cpp: (KJS::getUTCOffset): (KJS::getDSTOffsetSimple): (KJS::gregorianDateTimeToMS): (KJS::msToGregorianDateTime):
  • kjs/DateMath.h: (KJS::GregorianDateTime::GregorianDateTime): (KJS::GregorianDateTime::~GregorianDateTime): (KJS::GregorianDateTime::toTM):
  • kjs/date_object.cpp: (KJS::gmtoffset): (KJS::formatDate): (KJS::formatDateUTCVariant): (KJS::formatTime): (KJS::fillStructuresUsingTimeArgs): (KJS::fillStructuresUsingDateArgs): (KJS::DateInstance::getTime): (KJS::DateInstance::getUTCTime): (KJS::DateProtoFunc::callAsFunction): (KJS::DateObjectImp::construct): (KJS::DateObjectImp::callAsFunction): (KJS::DateObjectFuncImp::callAsFunction): (KJS::parseDate):
  • kjs/date_object.h:
Location:
trunk/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r17017 r17031  
     12006-10-13  Kevin McCullough  <[email protected]>
     2
     3        Reviewed by Adam, Geoff, Darin.
     4
     5       Fixed displaying the UTC offset and time zone string, as well as renamed the GregorianDateTime structure and clean up.
     6
     7        * ChangeLog:
     8        * kjs/DateMath.cpp:
     9        (KJS::getUTCOffset):
     10        (KJS::getDSTOffsetSimple):
     11        (KJS::gregorianDateTimeToMS):
     12        (KJS::msToGregorianDateTime):
     13        * kjs/DateMath.h:
     14        (KJS::GregorianDateTime::GregorianDateTime):
     15        (KJS::GregorianDateTime::~GregorianDateTime):
     16        (KJS::GregorianDateTime::toTM):
     17        * kjs/date_object.cpp:
     18        (KJS::gmtoffset):
     19        (KJS::formatDate):
     20        (KJS::formatDateUTCVariant):
     21        (KJS::formatTime):
     22        (KJS::fillStructuresUsingTimeArgs):
     23        (KJS::fillStructuresUsingDateArgs):
     24        (KJS::DateInstance::getTime):
     25        (KJS::DateInstance::getUTCTime):
     26        (KJS::DateProtoFunc::callAsFunction):
     27        (KJS::DateObjectImp::construct):
     28        (KJS::DateObjectImp::callAsFunction):
     29        (KJS::DateObjectFuncImp::callAsFunction):
     30        (KJS::parseDate):
     31        * kjs/date_object.h:
     32
     332006-10-13  Kevin McCullough  <[email protected]>
     34
     35        Reviewed by Adam.
     36
     37        Gets JavaScripCore tests running on windows.
     38
     39        * Scripts/run-javascriptcore-tests:
     40        * Scripts/webkitdirs.pm:
     41
    1422006-10-12  Geoffrey Garen  <[email protected]>
    243
  • trunk/JavaScriptCore/kjs/DateMath.cpp

    r17015 r17031  
    320320    static bool utcOffsetInitialized = false;
    321321    if (!utcOffsetInitialized) {
    322         struct ::tm ltime;
    323 
    324         memset(&ltime, 0, sizeof(ltime));
     322        tm localt;
     323
     324        memset(&localt, 0, sizeof(localt));
    325325       
    326326        // get the difference between this time zone and GMT
    327         ltime.tm_mday = 2;
    328         ltime.tm_year = 70;
    329 
    330         utcOffset = mktime(&ltime) - (hoursPerDay * secondsPerHour);
     327        localt.tm_mday = 2;
     328        localt.tm_year = 70;
     329
     330        utcOffset = mktime(&localt) - (hoursPerDay * secondsPerHour);
    331331        utcOffset *= -msPerSecond;
    332332
     
    357357    time_t localTime = static_cast<time_t>(localTimeSeconds);
    358358
    359     struct ::tm tm;
     359    tm localTM;
    360360    #if PLATFORM(WIN_OS)
    361     localtime_s(&tm, &localTime);
     361    localtime_s(&localTM, &localTime);
    362362    #else
    363     localtime_r(&localTime, &tm);
     363    localtime_r(&localTime, &localTM);
    364364    #endif
    365365   
    366     double diff = ((tm.tm_hour - offsetHour) * secondsPerHour) + ((tm.tm_min - offsetMinute) * 60);
     366    double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
    367367
    368368    if(diff < 0)
     
    392392}
    393393
    394 double dateToMS(const tm& t, double milliSeconds, bool inputIsUTC)
    395 {
    396 
    397     int day = dateToDayInYear(t.tm_year + 1900, t.tm_mon, t.tm_mday);
    398     double ms = timeToMS(t.tm_hour, t.tm_min, t.tm_sec, milliSeconds);
     394double gregorianDateTimeToMS(const GregorianDateTime& t, double milliSeconds, bool inputIsUTC)
     395{
     396
     397    int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay);
     398    double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);
    399399    double result = (day * msPerDay) + ms;
    400400
     
    407407}
    408408
    409 void msToTM(double ms, bool outputIsUTC, struct tm& tm)
     409void msToGregorianDateTime(double ms, bool outputIsUTC, struct GregorianDateTime& tm)
    410410{
    411411    // input is UTC
     
    417417    }
    418418
    419     tm.tm_sec   =  msToSeconds(ms);
    420     tm.tm_min   =  msToMinutes(ms);
    421     tm.tm_hour  =  msToHours(ms);
    422     tm.tm_wday  =  msToWeekDay(ms);
    423     tm.tm_mday  =  msToDayInMonth(ms);
    424     tm.tm_yday  =  dayInYear(ms, msToYear(ms));
    425     tm.tm_mon   =  msToMonth(ms);
    426     tm.tm_year  =  msToYear(ms) - 1900;
    427     tm.tm_isdst =  dstOff != 0.0;
    428 
    429     tm.tm_gmtoff = static_cast<long>((dstOff + getUTCOffset()) / usecPerMsec);
    430     tm.tm_zone = 0;
    431 }
    432 
    433 // converting between the two tm structures
    434 tm tmToKJStm(const struct ::tm& inTm)
    435 {
    436     struct tm ret;
    437     memset(&ret, 0, sizeof(ret));
    438 
    439     ret.tm_sec   =  inTm.tm_sec;
    440     ret.tm_min   =  inTm.tm_min;
    441     ret.tm_hour  =  inTm.tm_hour;
    442     ret.tm_wday  =  inTm.tm_wday;
    443     ret.tm_mday  =  inTm.tm_mday;
    444     ret.tm_yday  =  inTm.tm_yday;
    445     ret.tm_mon   =  inTm.tm_mon;
    446     ret.tm_year  =  inTm.tm_year;
    447     ret.tm_isdst =  inTm.tm_isdst;
    448 
    449 #if !PLATFORM(WIN_OS)
    450     ret.tm_gmtoff = inTm.tm_gmtoff;
    451     ret.tm_zone = inTm.tm_zone;
    452 #endif
    453 
    454     return ret;
    455 }
    456 
    457 ::tm KJStmToTm(const struct tm& inTm)
    458 {
    459     struct ::tm ret;
    460     memset(&ret, 0, sizeof(ret));
    461 
    462     ret.tm_sec   =  inTm.tm_sec;
    463     ret.tm_min   =  inTm.tm_min;
    464     ret.tm_hour  =  inTm.tm_hour;
    465     ret.tm_wday  =  inTm.tm_wday;
    466     ret.tm_mday  =  inTm.tm_mday;
    467     ret.tm_yday  =  inTm.tm_yday;
    468     ret.tm_mon   =  inTm.tm_mon;
    469     ret.tm_year  =  inTm.tm_year;
    470     ret.tm_isdst =  inTm.tm_isdst;
    471 
    472 #if !PLATFORM(WIN_OS)
    473     ret.tm_gmtoff = inTm.tm_gmtoff;
    474     ret.tm_zone = inTm.tm_zone;
    475 #endif
    476 
    477     return ret;
     419    tm.second   =  msToSeconds(ms);
     420    tm.minute   =  msToMinutes(ms);
     421    tm.hour     =  msToHours(ms);
     422    tm.weekDay  =  msToWeekDay(ms);
     423    tm.monthDay =  msToDayInMonth(ms);
     424    tm.yearDay  =  dayInYear(ms, msToYear(ms));
     425    tm.month    =  msToMonth(ms);
     426    tm.year     =  msToYear(ms) - 1900;
     427    tm.isDST =  dstOff != 0.0;
     428
     429    tm.utcOffset = static_cast<long>((dstOff + getUTCOffset()) / usecPerMsec);
     430    tm.timeZone = NULL;
    478431}
    479432
  • trunk/JavaScriptCore/kjs/DateMath.h

    r17010 r17031  
    4848// Intentionally overridding the default tm of the system
    4949// Not all OS' have the same members of their tm's
    50 struct tm {
    51     int tm_sec;
    52     int tm_min;
    53     int tm_hour;
    54     int tm_wday;
    55     int tm_mday;
    56     int tm_yday;
    57     int tm_mon;
    58     int tm_year;
    59     int tm_isdst;
    60     long tm_gmtoff;
    61     char* tm_zone;
     50struct GregorianDateTime {
     51    GregorianDateTime()
     52    {
     53        second = 0;
     54        minute = 0;
     55        hour = 0;
     56        weekDay = 0;
     57        monthDay = 0;
     58        yearDay = 0;
     59        month = 0;
     60        year = 0;
     61        isDST = 0;
     62        utcOffset = 0;
     63        timeZone = NULL;
     64    }
     65
     66    ~GregorianDateTime()
     67    {
     68        if (timeZone)
     69            delete timeZone;
     70    }
     71   
     72    GregorianDateTime(const tm& inTm)
     73        : second(inTm.tm_sec)
     74        , minute(inTm.tm_min)
     75        , hour(inTm.tm_hour)
     76        , weekDay(inTm.tm_wday)
     77        , monthDay(inTm.tm_mday)
     78        , yearDay(inTm.tm_yday)
     79        , month(inTm.tm_mon)
     80        , year(inTm.tm_year)
     81        , isDST(inTm.tm_isdst)
     82    {
     83#if !PLATFORM(WIN_OS)
     84        utcOffset = static_cast<int>(inTm.tm_gmtoff);
     85
     86        int inZoneSize = strlen(inTm.tm_zone) + 1;
     87        timeZone = new char[inZoneSize];
     88        strncpy(timeZone, inTm.tm_zone, inZoneSize);
     89#else
     90        utcOffset = 0;
     91        timeZone = NULL;
     92#endif
     93    }
     94
     95    tm toTM() const
     96    {
     97        tm ret;
     98        memset(&ret, 0, sizeof(ret));
     99
     100        ret.tm_sec   =  second;
     101        ret.tm_min   =  minute;
     102        ret.tm_hour  =  hour;
     103        ret.tm_wday  =  weekDay;
     104        ret.tm_mday  =  monthDay;
     105        ret.tm_yday  =  yearDay;
     106        ret.tm_mon   =  month;
     107        ret.tm_year  =  year;
     108        ret.tm_isdst =  isDST;
     109
     110#if !PLATFORM(WIN_OS)
     111        ret.tm_gmtoff = static_cast<long>(utcOffset);
     112        ret.tm_zone = timeZone;
     113#endif
     114
     115        return ret;
     116    }
     117
     118    int second;
     119    int minute;
     120    int hour;
     121    int weekDay;
     122    int monthDay;
     123    int yearDay;
     124    int month;
     125    int year;
     126    int  isDST;
     127    int utcOffset;
     128    char* timeZone;
    62129};
    63130
     
    76143
    77144// Exported Functions //
    78 void msToTM(double, bool outputIsUTC, struct tm& );
    79 double dateToMS(const tm&, double, bool inputIsUTC);
     145void msToGregorianDateTime(double, bool outputIsUTC, struct GregorianDateTime&);
     146double gregorianDateTimeToMS(const GregorianDateTime&, double, bool inputIsUTC);
    80147double getUTCOffset();
    81 
    82 tm tmToKJStm(const struct ::tm&);
    83 ::tm KJStmToTm(const struct tm&);
    84148
    85149}   //namespace KJS
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r17015 r17031  
    6666static double timeClip(double);
    6767
    68 inline int gmtoffset(const tm& t)
    69 {
    70     return static_cast<int>(t.tm_gmtoff);
     68inline int gmtoffset(const GregorianDateTime& t)
     69{
     70    return t.utcOffset;
    7171}
    7272
     
    157157#endif // PLATFORM(MAC)
    158158
    159 static UString formatDate(const tm &t)
     159static UString formatDate(const GregorianDateTime &t)
    160160{
    161161    char buffer[100];
    162162    snprintf(buffer, sizeof(buffer), "%s %s %02d %04d",
    163         weekdayName[(t.tm_wday + 6) % 7],
    164         monthName[t.tm_mon], t.tm_mday, t.tm_year + 1900);
     163        weekdayName[(t.weekDay + 6) % 7],
     164        monthName[t.month], t.monthDay, t.year + 1900);
    165165    return buffer;
    166166}
    167167
    168 static UString formatDateUTCVariant(const tm &t)
     168static UString formatDateUTCVariant(const GregorianDateTime &t)
    169169{
    170170    char buffer[100];
    171171    snprintf(buffer, sizeof(buffer), "%s, %02d %s %04d",
    172         weekdayName[(t.tm_wday + 6) % 7],
    173         t.tm_mday, monthName[t.tm_mon], t.tm_year + 1900);
     172        weekdayName[(t.weekDay + 6) % 7],
     173        t.monthDay, monthName[t.month], t.year + 1900);
    174174    return buffer;
    175175}
    176176
    177 static UString formatTime(const tm &t, bool utc)
     177static UString formatTime(const GregorianDateTime &t, bool utc)
    178178{
    179179    char buffer[100];
    180180    if (utc) {
    181         snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.tm_hour, t.tm_min, t.tm_sec);
     181        snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.hour, t.minute, t.second);
    182182    } else {
    183183        int offset = abs(gmtoffset(t));
    184184        char tzname[70];
    185         struct ::tm gtm = KJStmToTm(t);
     185        struct ::tm gtm = t.toTM();
    186186        strftime(tzname, sizeof(tzname), "%Z", &gtm);
    187187
    188188        if (tzname) {
    189189            snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)",
    190                 t.tm_hour, t.tm_min, t.tm_sec,
     190                t.hour, t.minute, t.second,
    191191                gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, tzname);
    192192        } else {
    193193            snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
    194                 t.tm_hour, t.tm_min, t.tm_sec,
     194                t.hour, t.minute, t.second,
    195195                gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
    196196        }
     
    203203//
    204204// Format of member function: f([hour,] [min,] [sec,] [ms])
    205 static void fillStructuresUsingTimeArgs(ExecState *exec, const List &args, int maxArgs, double *ms, tm *t)
     205static void fillStructuresUsingTimeArgs(ExecState *exec, const List &args, int maxArgs, double *ms, GregorianDateTime *t)
    206206{
    207207    double milliseconds = 0;
     
    215215    // hours
    216216    if (maxArgs >= 4 && idx < numArgs) {
    217         t->tm_hour = 0;
     217        t->hour = 0;
    218218        milliseconds += args[idx++]->toInt32(exec) * msPerHour;
    219219    }
     
    221221    // minutes
    222222    if (maxArgs >= 3 && idx < numArgs) {
    223         t->tm_min = 0;
     223        t->minute = 0;
    224224        milliseconds += args[idx++]->toInt32(exec) * msPerMinute;
    225225    }
     
    227227    // seconds
    228228    if (maxArgs >= 2 && idx < numArgs) {
    229         t->tm_sec = 0;
     229        t->second = 0;
    230230        milliseconds += args[idx++]->toInt32(exec) * msPerSecond;
    231231    }
     
    245245//
    246246// Format of member function: f([years,] [months,] [days])
    247 static void fillStructuresUsingDateArgs(ExecState *exec, const List &args, int maxArgs, double *ms, tm *t)
     247static void fillStructuresUsingDateArgs(ExecState *exec, const List &args, int maxArgs, double *ms, GregorianDateTime *t)
    248248{
    249249    int idx = 0;
     
    256256    // years
    257257    if (maxArgs >= 3 && idx < numArgs)
    258         t->tm_year = args[idx++]->toInt32(exec) - 1900;
     258        t->year = args[idx++]->toInt32(exec) - 1900;
    259259 
    260260    // months
    261261    if (maxArgs >= 2 && idx < numArgs)
    262         t->tm_mon = args[idx++]->toInt32(exec);
     262        t->month = args[idx++]->toInt32(exec);
    263263 
    264264    // days
    265265    if (idx < numArgs) {
    266         t->tm_mday = 0;
     266        t->monthDay = 0;
    267267        *ms += args[idx]->toInt32(exec) * msPerDay;
    268268    }
     
    278278}
    279279
    280 bool DateInstance::getTime(tm &t, int &offset) const
     280bool DateInstance::getTime(GregorianDateTime &t, int &offset) const
    281281{
    282282    double milli = internalValue()->getNumber();
     
    284284        return false;
    285285   
    286     msToTM(milli, false, t);
     286    msToGregorianDateTime(milli, false, t);
    287287    offset = gmtoffset(t);
    288288    return true;
    289289}
    290290
    291 bool DateInstance::getUTCTime(tm &t) const
     291bool DateInstance::getUTCTime(GregorianDateTime &t) const
    292292{
    293293    double milli = internalValue()->getNumber();
     
    295295        return false;
    296296   
    297     msToTM(milli, true, t);
     297    msToGregorianDateTime(milli, true, t);
    298298    return true;
    299299}
     
    305305        return false;
    306306   
    307     tm t;
    308     msToTM(milli, false, t);
     307    GregorianDateTime t;
     308    msToGregorianDateTime(milli, false, t);
    309309    offset = gmtoffset(t);
    310310    return true;
     
    453453  double ms = milli - secs * msPerSecond;
    454454
    455   tm t;
    456   msToTM(milli, utc, t);
     455  GregorianDateTime t;
     456  msToGregorianDateTime(milli, utc, t);
    457457
    458458  switch (id) {
     
    505505    // IE returns the full year even in getYear.
    506506    if (exec->dynamicInterpreter()->compatMode() == Interpreter::IECompat)
    507       return jsNumber(1900 + t.tm_year);
    508     return jsNumber(t.tm_year);
     507      return jsNumber(1900 + t.year);
     508    return jsNumber(t.year);
    509509  case GetFullYear:
    510     return jsNumber(1900 + t.tm_year);
     510    return jsNumber(1900 + t.year);
    511511  case GetMonth:
    512     return jsNumber(t.tm_mon);
     512    return jsNumber(t.month);
    513513  case GetDate:
    514     return jsNumber(t.tm_mday);
     514    return jsNumber(t.monthDay);
    515515  case GetDay:
    516     return jsNumber(t.tm_wday);
     516    return jsNumber(t.weekDay);
    517517  case GetHours:
    518     return jsNumber(t.tm_hour);
     518    return jsNumber(t.hour);
    519519  case GetMinutes:
    520     return jsNumber(t.tm_min);
     520    return jsNumber(t.minute);
    521521  case GetSeconds:
    522     return jsNumber(t.tm_sec);
     522    return jsNumber(t.second);
    523523  case GetMilliSeconds:
    524524    return jsNumber(ms);
     
    552552    break;
    553553  case SetYear:
    554     t.tm_year = (args[0]->toInt32(exec) > 99 || args[0]->toInt32(exec) < 0) ? args[0]->toInt32(exec) - 1900 : args[0]->toInt32(exec);
     554    t.year = (args[0]->toInt32(exec) > 99 || args[0]->toInt32(exec) < 0) ? args[0]->toInt32(exec) - 1900 : args[0]->toInt32(exec);
    555555    break;
    556556  }
     
    559559      id == SetMinutes || id == SetHours || id == SetDate ||
    560560      id == SetMonth || id == SetFullYear ) {
    561     result = jsNumber(dateToMS(t, ms, utc));
     561    result = jsNumber(gregorianDateTimeToMS(t, ms, utc));
    562562    thisDateObj->setInternalValue(result);
    563563  }
     
    635635      value = NaN;
    636636    } else {
    637       tm t;
     637      GregorianDateTime t;
    638638      memset(&t, 0, sizeof(t));
    639639      int year = args[0]->toInt32(exec);
    640       t.tm_year = (year >= 0 && year <= 99) ? year : year - 1900;
    641       t.tm_mon = args[1]->toInt32(exec);
    642       t.tm_mday = (numArgs >= 3) ? args[2]->toInt32(exec) : 1;
    643       t.tm_hour = (numArgs >= 4) ? args[3]->toInt32(exec) : 0;
    644       t.tm_min = (numArgs >= 5) ? args[4]->toInt32(exec) : 0;
    645       t.tm_sec = (numArgs >= 6) ? args[5]->toInt32(exec) : 0;
    646       t.tm_isdst = -1;
     640      t.year = (year >= 0 && year <= 99) ? year : year - 1900;
     641      t.month = args[1]->toInt32(exec);
     642      t.monthDay = (numArgs >= 3) ? args[2]->toInt32(exec) : 1;
     643      t.hour = (numArgs >= 4) ? args[3]->toInt32(exec) : 0;
     644      t.minute = (numArgs >= 5) ? args[4]->toInt32(exec) : 0;
     645      t.second = (numArgs >= 6) ? args[5]->toInt32(exec) : 0;
     646      t.isDST = -1;
    647647      double ms = (numArgs >= 7) ? roundValue(exec, args[6]) : 0;
    648       value = dateToMS(t, ms, false);
     648      value = gregorianDateTimeToMS(t, ms, false);
    649649    }
    650650  }
     
    659659{
    660660    time_t t = time(0);
    661     tm ts = tmToKJStm(*localtime(&t));
     661    GregorianDateTime ts(*localtime(&t));
    662662    return jsString(formatDate(ts) + " " + formatTime(ts, false));
    663663}
     
    689689    }
    690690
    691     tm t;
     691    GregorianDateTime t;
    692692    memset(&t, 0, sizeof(t));
    693693    int year = args[0]->toInt32(exec);
    694     t.tm_year = (year >= 0 && year <= 99) ? year : year - 1900;
    695     t.tm_mon = args[1]->toInt32(exec);
    696     t.tm_mday = (n >= 3) ? args[2]->toInt32(exec) : 1;
    697     t.tm_hour = (n >= 4) ? args[3]->toInt32(exec) : 0;
    698     t.tm_min = (n >= 5) ? args[4]->toInt32(exec) : 0;
    699     t.tm_sec = (n >= 6) ? args[5]->toInt32(exec) : 0;
     694    t.year = (year >= 0 && year <= 99) ? year : year - 1900;
     695    t.month = args[1]->toInt32(exec);
     696    t.monthDay = (n >= 3) ? args[2]->toInt32(exec) : 1;
     697    t.hour = (n >= 4) ? args[3]->toInt32(exec) : 0;
     698    t.minute = (n >= 5) ? args[4]->toInt32(exec) : 0;
     699    t.second = (n >= 6) ? args[5]->toInt32(exec) : 0;
    700700    double ms = (n >= 7) ? roundValue(exec, args[6]) : 0;
    701     return jsNumber(dateToMS(t, ms, true));
     701    return jsNumber(gregorianDateTimeToMS(t, ms, true));
    702702  }
    703703}
     
    10561056    // fall back to local timezone
    10571057    if (!haveTZ) {
    1058         tm t;
     1058        GregorianDateTime t;
    10591059        memset(&t, 0, sizeof(tm));
    1060         t.tm_mday = day;
    1061         t.tm_mon = month;
    1062         t.tm_year = year - 1900;
    1063         t.tm_isdst = -1;
    1064         t.tm_sec = second;
    1065         t.tm_min = minute;
    1066         t.tm_hour = hour;
    1067 
    1068         // Use our dateToMS() rather than mktime() as the latter can't handle the full year range.
    1069         return dateToMS(t, 0, false);
     1060        t.monthDay = day;
     1061        t.month = month;
     1062        t.year = year - 1900;
     1063        t.isDST = -1;
     1064        t.second = second;
     1065        t.minute = minute;
     1066        t.hour = hour;
     1067
     1068        // Use our gregorianDateTimeToMS() rather than mktime() as the latter can't handle the full year range.
     1069        return gregorianDateTimeToMS(t, 0, false);
    10701070    }
    10711071
  • trunk/JavaScriptCore/kjs/date_object.h

    r17010 r17031  
    2727namespace KJS {
    2828
    29     struct tm;
     29    struct GregorianDateTime;
    3030
    3131    class FunctionPrototype;
     
    3636        DateInstance(JSObject *proto);
    3737       
    38         bool getTime(tm &t, int &gmtoffset) const;
    39         bool getUTCTime(tm &t) const;
    40         bool getTime(double &ms, int &gmtoffset) const;
    41         bool getUTCTime(double &ms) const;
     38        bool getTime(GregorianDateTime&, int& offset) const;
     39        bool getUTCTime(GregorianDateTime&) const;
     40        bool getTime(double& milli, int& offset) const;
     41        bool getUTCTime(double& milli) const;
    4242       
    4343        virtual const ClassInfo *classInfo() const { return &info; }
Note: See TracChangeset for help on using the changeset viewer.