Changeset 10655 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 28, 2005, 6:55:11 PM (20 years ago)
Author:
ggaren
Message:
  • Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com

Reviewed by darin.

  • kjs/date_object.cpp: (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r10654 r10655  
     12005-09-28  Geoffrey Garen  <[email protected]>
     2
     3        - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display
     4          "NAN/Undefined" for www.washingtonpost.com
     5         
     6        Reviewed by darin.
     7
     8        * kjs/date_object.cpp:
     9        (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
     10        invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
     11
    1122005-09-28  Maciej Stachowiak  <[email protected]>
    213
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r10571 r10655  
    387387}
    388388
    389 static double timeZoneOffset(const struct tm *t)
     389static long timeZoneOffset(const struct tm *t)
    390390{
    391391#if defined BSD || defined(__linux__) || defined(__APPLE__)
     
    10921092     //
    10931093     double result = -1;
    1094      int offset = 0;
     1094     long offset = 0;
    10951095     bool have_tz = false;
    10961096     char *newPosStr;
     
    13011301     }
    13021302
    1303      // don't fail if the time zone is missing, some
    1304      // broken mail-/news-clients omit the time zone
    13051303     if (*dateString) {
    13061304       if (strncasecmp(dateString, "GMT", 3) == 0 ||
     
    13451343           }
    13461344         }
    1347          // Bail out if we found an unknown timezone
    1348          if (!have_tz)
     1345         // If the time zone is missing or malformed, substitute the local time zone.
     1346         // Some websites (4275206) omit the time zone.
     1347         if (!have_tz) {
     1348           time_t now;
     1349           struct tm t;
     1350           
     1351           time(&now);
     1352           if (now == -1)
    13491353             return invalidDate;
     1354           
     1355           localtime_r(&now, &t);
     1356           offset = -timeZoneOffset(&t);
     1357           
     1358           have_tz = true;
     1359         }
    13501360       }
    13511361     }
     
    13851395     }
    13861396     
    1387      result = ymdhms_to_seconds(year, month+1, day, hour, minute, second) - (offset*60);
     1397     result = ymdhms_to_seconds(year, month+1, day, hour, minute, second) - (offset * 60);
    13881398     return result;
    13891399}
Note: See TracChangeset for help on using the changeset viewer.