[webkit-changes] cvs commit: JavaScriptCore/kjs date_object.cpp
Timothy
thatcher at opensource.apple.com
Wed Sep 28 19:59:48 PDT 2005
thatcher 05/09/28 19:59:48
Modified: . Tag: Safari-Den-branch ChangeLog
kjs Tag: Safari-Den-branch date_object.cpp
Log:
Merges fixes from TOT to Safari-Den-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.34.2.8 +17 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.677.6.34.2.7
retrieving revision 1.677.6.34.2.8
diff -u -r1.677.6.34.2.7 -r1.677.6.34.2.8
--- ChangeLog 28 Sep 2005 17:48:18 -0000 1.677.6.34.2.7
+++ ChangeLog 29 Sep 2005 02:59:46 -0000 1.677.6.34.2.8
@@ -1,7 +1,24 @@
=== JavaScriptCore-416.10 ===
+2005-09-28 Timothy Hatcher <timothy at apple.com>
+
+ Merges fixes from TOT to Safari-Den-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-Den-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.1.2.2 +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.1.2.1
retrieving revision 1.39.8.1.2.2
diff -u -r1.39.8.1.2.1 -r1.39.8.1.2.2
--- date_object.cpp 27 Sep 2005 23:39:05 -0000 1.39.8.1.2.1
+++ date_object.cpp 29 Sep 2005 02:59:47 -0000 1.39.8.1.2.2
@@ -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