Changeset 51986 in webkit
- Timestamp:
- Dec 11, 2009 7:39:30 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r51978 r51986 1 2009-12-11 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Fix a problem that JSC::gregorianDateTimeToMS() returns a negative 6 value for a huge year value. 7 https://bugs.webkit.org/show_bug.cgi?id=32304 8 9 * wtf/DateMath.cpp: 10 (WTF::dateToDaysFrom1970): Renamed from dateToDayInYear, and changed the return type to double. 11 (WTF::calculateDSTOffset): Follow the dateToDaysFrom1970() change. 12 (WTF::timeClip): Use maxECMAScriptTime. 13 (JSC::gregorianDateTimeToMS): Follow the dateToDaysFrom1970() change. 14 1 15 2009-12-10 Adam Barth <abarth@webkit.org> 2 16 -
trunk/JavaScriptCore/wtf/DateMath.cpp
r51955 r51986 121 121 122 122 static const double maxUnixTime = 2145859200.0; // 12/31/2037 123 // ECMAScript asks not to support for a date of which total 124 // millisecond value is larger than the following value. 125 // See 15.9.1.14 of ECMA-262 5th edition. 126 static const double maxECMAScriptTime = 8.64E15; 123 127 124 128 // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1. … … 307 311 } 308 312 309 static int dateToDayInYear(int year, int month, int day)313 static double dateToDaysFrom1970(int year, int month, int day) 310 314 { 311 315 year += month / 12; … … 317 321 } 318 322 319 int yearday = static_cast<int>(floor(daysFrom1970ToYear(year))); 323 double yearday = floor(daysFrom1970ToYear(year)); 324 ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0)); 320 325 int monthday = monthToDayInYear(month, isLeapYear(year)); 321 326 … … 453 458 int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear); 454 459 int month = monthFromDayInYear(dayInYearLocal, leapYear); 455 int day = dateToDayInYear(equivalentYear, month, dayInMonth);460 double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth); 456 461 ms = (day * msPerDay) + msToMilliseconds(ms); 457 462 } … … 842 847 if (!isfinite(t)) 843 848 return NaN; 844 if (fabs(t) > 8.64E15)849 if (fabs(t) > maxECMAScriptTime) 845 850 return NaN; 846 851 return trunc(t); … … 928 933 double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC) 929 934 { 930 int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay);935 double day = dateToDaysFrom1970(t.year + 1900, t.month, t.monthDay); 931 936 double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds); 932 937 double result = (day * WTF::msPerDay) + ms; -
trunk/LayoutTests/ChangeLog
r51985 r51986 1 2009-12-11 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Fix a problem that JSC::gregorianDateTimeToMS() returns a negative 6 value for a huge year value. 7 https://bugs.webkit.org/show_bug.cgi?id=32304 8 9 * fast/js/date-daysfrom1970-overflow-expected.txt: Added. 10 * fast/js/date-daysfrom1970-overflow.html: Added. 11 * fast/js/script-tests/date-daysfrom1970-overflow.js: Added. 12 1 13 2009-12-11 Benjamin Poulain <benjamin.poulain@nokia.com> 2 14
Note: See TracChangeset
for help on using the changeset viewer.