Changeset 10675 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Sep 30, 2005, 9:16:13 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/date_object.cpp
r10655 r10675 1092 1092 // 1093 1093 double result = -1; 1094 longoffset = 0;1094 int offset = 0; 1095 1095 bool have_tz = false; 1096 1096 char *newPosStr; … … 1301 1301 } 1302 1302 1303 // Don't fail if the time zone is missing. 1304 // Some websites omit the time zone (4275206). 1303 1305 if (*dateString) { 1304 1306 if (strncasecmp(dateString, "GMT", 3) == 0 || … … 1339 1341 if (0 == strncasecmp(dateString, known_zones[i].tzName, strlen(known_zones[i].tzName))) { 1340 1342 offset = known_zones[i].tzOffset; 1343 dateString += strlen(known_zones[i].tzName); 1341 1344 have_tz = true; 1342 1345 break; 1343 1346 } 1344 1347 } 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)1353 return invalidDate;1354 1355 localtime_r(&now, &t);1356 offset = -timeZoneOffset(&t);1357 1358 have_tz = true;1359 }1360 1348 } 1361 1349 } … … 1368 1356 if (errno) 1369 1357 return invalidDate; 1358 dateString = newPosStr; 1370 1359 } 1360 1361 while (isspace(*dateString)) 1362 dateString++; 1363 1364 // Trailing garbage 1365 if (*dateString != '\0') 1366 return invalidDate; 1371 1367 1372 1368 // Y2K: Solve 2 digit years … … 1377 1373 year += 1900; // Y2K 1378 1374 1375 // fall back to midnight, local timezone 1379 1376 if (!have_tz) { 1380 // fall back to midnight, local timezone1381 1377 struct tm t; 1382 1378 memset(&t, 0, sizeof(tm)); … … 1395 1391 } 1396 1392 1397 result = ymdhms_to_seconds(year, month +1, day, hour, minute, second) - (offset * 60);1393 result = ymdhms_to_seconds(year, month + 1, day, hour, minute, second) - (offset * 60); 1398 1394 return result; 1399 1395 }
Note:
See TracChangeset
for help on using the changeset viewer.