[webkit-changes] cvs commit: JavaScriptCore/kjs date_object.cpp
Geoffrey
ggaren at opensource.apple.com
Wed Sep 28 18:55:12 PDT 2005
ggaren 05/09/28 18:55:12
Modified: . ChangeLog
kjs date_object.cpp
Log:
- 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
1.845 +11 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.844
retrieving revision 1.845
diff -u -r1.844 -r1.845
--- ChangeLog 28 Sep 2005 22:27:38 -0000 1.844
+++ ChangeLog 29 Sep 2005 01:55:09 -0000 1.845
@@ -1,3 +1,14 @@
+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-28 Maciej Stachowiak <mjs at apple.com>
Patch from George Staikos, reviewed by me.
1.57 +17 -7 JavaScriptCore/kjs/date_object.cpp
Index: date_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- date_object.cpp 20 Sep 2005 08:07:57 -0000 1.56
+++ date_object.cpp 29 Sep 2005 01:55:11 -0000 1.57
@@ -386,7 +386,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);
@@ -1091,7 +1091,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();
@@ -1300,8 +1300,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) {
@@ -1344,9 +1342,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;
+ }
}
}
@@ -1384,7 +1394,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