Changeset 16783 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Oct 4, 2006, 1:35:58 PM (19 years ago)
Author:
kmccullo
Message:

Reviewed by Adam.

  • wtf/Assertions.cpp: Changed assertion formatting to omit the "======" lines so you can see more assertions in less space. Also improved format of file/line information so it works with more development environments.
File:
1 edited

Legend:

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

    r16780 r16783  
    6464 * each month, where index 0 is January, and day 0 is January 1.
    6565 */
    66 static double firstDayOfMonth[2][12] = {
    67     {0.0, 31.0, 59.0, 90.0, 120.0, 151.0, 181.0, 212.0, 243.0, 273.0, 304.0, 334.0},
    68     {0.0, 31.0, 60.0, 91.0, 121.0, 152.0, 182.0, 213.0, 244.0, 274.0, 305.0, 335.0}
     66static int firstDayOfMonth[2][12] = {
     67    {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
     68    {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
    6969};
    7070
     
    109109}
    110110
    111 static inline int msToDays(double ms)
     111static inline double msToDays(double ms)
    112112{
    113113    return floor(ms / msPerDay);
    114114}
    115115
    116 static inline int msToYear(double ms)
    117 {
    118     int y = floor(ms /(msPerDay*365.2425)) + 1970;
     116static inline double msToYear(double ms)
     117{
     118    double y = floor(ms /(msPerDay*365.2425)) + 1970;
    119119    double t2 = msFrom1970ToYear(y);
    120120
     
    144144}
    145145
    146 static inline int dayInYear(double ms, int year)
     146static inline double dayInYear(double ms, int year)
    147147{
    148148    return msToDays(ms) - daysFrom1970ToYear(year);
     
    266266}
    267267
    268 static inline double monthToDayInYear(int month, bool isLeapYear)
     268static inline int monthToDayInYear(int month, bool isLeapYear)
    269269{
    270270    return firstDayOfMonth[isLeapYear][month];
     
    276276}
    277277
    278 static double dateToDayInYear(double year, double month, double day)
     278static int dateToDayInYear(int year, int month, int day)
    279279{
    280280    year += floor(month / 12);
     
    284284        month += 12;
    285285
    286     double yearday = floor(msFrom1970ToYear(year) / msPerDay);
    287     double monthday = monthToDayInYear(month, isLeapYear(year));
     286    int yearday = static_cast<int>(floor(msFrom1970ToYear(year) / msPerDay));
     287    int monthday = monthToDayInYear(month, isLeapYear(year));
    288288
    289289    return yearday + monthday + day - 1;
     
    363363    prtm.tm_hour  =  msToHours(offsetTime);
    364364
    365 
    366     time_t localTime = localTimeSeconds;
     365    // FIXME: time_t has a potential problem in 2038
     366    time_t localTime = static_cast<time_t>(localTimeSeconds);
    367367
    368368    struct tm tm;
     
    390390    if (ms < 0.0 || ms > 2145916800000.0) {
    391391        int year;
    392         double day;
     392        int day;
    393393
    394394        year = equivalentYearForDST(msToYear(ms));
     
    417417double dateToMseconds(tm* t, double ms, bool inputIsUTC)
    418418{
    419     double day = dateToDayInYear(t->tm_year + 1900, t->tm_mon, t->tm_mday);
     419    int day = dateToDayInYear(t->tm_year + 1900, t->tm_mon, t->tm_mday);
    420420    double msec_time = timeToMseconds(t->tm_hour, t->tm_min, t->tm_sec, ms);
    421421    double result = (day * msPerDay) + msec_time;
     
    446446    #if !PLATFORM(WIN_OS)
    447447    struct tm xtm;
    448     time_t seconds = ms/usecPerMsec;
     448    // FIXME: time_t has a potential problem in 2038
     449    time_t seconds = static_cast<time_t>(ms/usecPerMsec);
    449450    localtime_r(&seconds, &xtm);
    450451    tm.tm_gmtoff = xtm.tm_gmtoff;
Note: See TracChangeset for help on using the changeset viewer.