| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 // ECMA 262 - 15.9.1.12 | 224 // ECMA 262 - 15.9.1.12 |
| 225 function TimeInYear(year) { | 225 function TimeInYear(year) { |
| 226 return DaysInYear(year) * msPerDay; | 226 return DaysInYear(year) * msPerDay; |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 // Compute modified Julian day from year, month, date. | 230 // Compute modified Julian day from year, month, date. |
| 231 // The missing days in 1582 are ignored for JavaScript compatibility. | |
| 232 function ToJulianDay(year, month, date) { | 231 function ToJulianDay(year, month, date) { |
| 233 var jy = (month > 1) ? year : year - 1; | 232 var jy = (month > 1) ? year : year - 1; |
| 234 var jm = (month > 1) ? month + 2 : month + 14; | 233 var jm = (month > 1) ? month + 2 : month + 14; |
| 235 var ja = FLOOR(jy / 100); | 234 var ja = FLOOR(jy / 100); |
| 236 return FLOOR(FLOOR(365.25*jy) + FLOOR(30.6001*jm) + date + 1720995) + 2 - ja +
FLOOR(0.25*ja); | 235 return FLOOR(FLOOR(365.25*jy) + FLOOR(30.6001*jm) + date + 1720995) + 2 - ja +
FLOOR(0.25*ja); |
| 237 } | 236 } |
| 238 | 237 |
| 239 var four_year_cycle_table = CalculateDateTable(); | 238 var four_year_cycle_table = CalculateDateTable(); |
| 240 | 239 |
| 241 | 240 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 return gmt + ' (' + LocalTimezone(time) + ')'; | 560 return gmt + ' (' + LocalTimezone(time) + ')'; |
| 562 } | 561 } |
| 563 | 562 |
| 564 | 563 |
| 565 function DatePrintString(time) { | 564 function DatePrintString(time) { |
| 566 return DateString(time) + ' ' + TimeString(time); | 565 return DateString(time) + ' ' + TimeString(time); |
| 567 } | 566 } |
| 568 | 567 |
| 569 // ------------------------------------------------------------------- | 568 // ------------------------------------------------------------------- |
| 570 | 569 |
| 570 // Reused output buffer. |
| 571 var parse_buffer = $Array(7); |
| 571 | 572 |
| 572 // ECMA 262 - 15.9.4.2 | 573 // ECMA 262 - 15.9.4.2 |
| 573 function DateParse(string) { | 574 function DateParse(string) { |
| 574 var arr = %DateParseString(ToString(string)); | 575 var arr = %DateParseString(ToString(string), parse_buffer); |
| 575 if (IS_NULL(arr)) return $NaN; | 576 if (IS_NULL(arr)) return $NaN; |
| 576 | 577 |
| 577 var day = MakeDay(arr[0], arr[1], arr[2]); | 578 var day = MakeDay(arr[0], arr[1], arr[2]); |
| 578 var time = MakeTime(arr[3], arr[4], arr[5], 0); | 579 var time = MakeTime(arr[3], arr[4], arr[5], 0); |
| 579 var date = MakeDate(day, time); | 580 var date = MakeDate(day, time); |
| 580 | 581 |
| 581 if (IS_NULL(arr[6])) { | 582 if (IS_NULL(arr[6])) { |
| 582 return TimeClip(UTC(date)); | 583 return TimeClip(UTC(date)); |
| 583 } else { | 584 } else { |
| 584 return TimeClip(date - arr[6] * 1000); | 585 return TimeClip(date - arr[6] * 1000); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 "setFullYear", DateSetFullYear, | 1042 "setFullYear", DateSetFullYear, |
| 1042 "setUTCFullYear", DateSetUTCFullYear, | 1043 "setUTCFullYear", DateSetUTCFullYear, |
| 1043 "toGMTString", DateToGMTString, | 1044 "toGMTString", DateToGMTString, |
| 1044 "toUTCString", DateToUTCString, | 1045 "toUTCString", DateToUTCString, |
| 1045 "getYear", DateGetYear, | 1046 "getYear", DateGetYear, |
| 1046 "setYear", DateSetYear | 1047 "setYear", DateSetYear |
| 1047 )); | 1048 )); |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 SetupDate(); | 1051 SetupDate(); |
| OLD | NEW |