[webkit-changes] cvs commit: JavaScriptCore/kjs date_object.cpp

Timothy thatcher at opensource.apple.com
Wed Sep 28 19:58:08 PDT 2005


thatcher    05/09/28 19:58:08

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               kjs      Tag: Safari-2-0-branch date_object.cpp
  Log:
  	    Merges fixes from TOT to Safari-2-0-branch
  
      2005-09-28  Geoffrey Garen  <ggaren at apple.com>
  
  	    - 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.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.677.6.40 +17 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.677.6.39
  retrieving revision 1.677.6.40
  diff -u -r1.677.6.39 -r1.677.6.40
  --- ChangeLog	28 Sep 2005 18:52:19 -0000	1.677.6.39
  +++ ChangeLog	29 Sep 2005 02:58:06 -0000	1.677.6.40
  @@ -1,7 +1,24 @@
   === JavaScriptCore-417 ===
   
  +2005-09-28  Timothy Hatcher  <timothy at apple.com>
  +
  +	    Merges fixes from TOT to Safari-2-0-branch
  +
  +    2005-09-28  Geoffrey Garen  <ggaren at apple.com>
  +
  +	    - 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.
  +
   2005-09-27  Timothy Hatcher  <timothy at apple.com>
   
  +	    Merges fixes from TOT to Safari-2-0-branch
  +
       2005-09-26  Geoffrey Garen  <ggaren at apple.com>
   
           - Fixed <rdar://problem/4244084> Denver Regression: Date.setUTCFullYear() broken
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.39.8.3  +17 -7     JavaScriptCore/kjs/date_object.cpp
  
  Index: date_object.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
  retrieving revision 1.39.8.2
  retrieving revision 1.39.8.3
  diff -u -r1.39.8.2 -r1.39.8.3
  --- date_object.cpp	27 Sep 2005 23:41:03 -0000	1.39.8.2
  +++ date_object.cpp	29 Sep 2005 02:58:07 -0000	1.39.8.3
  @@ -376,7 +376,7 @@
     return wd;
   }
   
  -static double timeZoneOffset(const struct tm *t)
  +static long timeZoneOffset(const struct tm *t)
   {
   #if defined BSD || defined(__linux__) || defined(__APPLE__)
     return -(t->tm_gmtoff / 60);
  @@ -1036,7 +1036,7 @@
        // We ignore the weekday
        //
        double result = -1;
  -     int offset = 0;
  +     long offset = 0;
        bool have_tz = false;
        char *newPosStr;
        const char *dateString = _date.ascii();
  @@ -1247,8 +1247,6 @@
          dateString = newPosStr;
        }
   
  -     // don't fail if the time zone is missing, some
  -     // broken mail-/news-clients omit the time zone
        if (*dateString) {
          if (strncasecmp(dateString, "GMT", 3) == 0 ||
   	   strncasecmp(dateString, "UTC", 3) == 0) {
  @@ -1291,9 +1289,21 @@
                break;
              }
            }
  -         // Bail out if we found an unknown timezone
  -         if (!have_tz)
  +         // If the time zone is missing or malformed, substitute the local time zone. 
  +         // Some websites (4275206) omit the time zone.
  +         if (!have_tz) {
  +           time_t now;
  +           struct tm t;
  +           
  +           time(&now);
  +           if (now == -1)
                return invalidDate;
  +           
  +           localtime_r(&now, &t);
  +           offset = -timeZoneOffset(&t);
  +           
  +           have_tz = true;
  +         }
          }
        }
   
  @@ -1331,7 +1341,7 @@
          return makeTime(&t, 0, false) / 1000.0;
        }
        
  -     result = ymdhms_to_seconds(year, month+1, day, hour, minute, second) - (offset*60);
  +     result = ymdhms_to_seconds(year, month+1, day, hour, minute, second) - (offset * 60);
        return result;
   }
   
  
  
  



More information about the webkit-changes mailing list