| 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 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
| 6 | 6 |
| 7 (function(global, utils) { | 7 (function(global, utils) { |
| 8 | 8 |
| 9 "use strict"; | 9 "use strict"; |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (!IsFinite(min)) return NaN; | 63 if (!IsFinite(min)) return NaN; |
| 64 if (!IsFinite(sec)) return NaN; | 64 if (!IsFinite(sec)) return NaN; |
| 65 if (!IsFinite(ms)) return NaN; | 65 if (!IsFinite(ms)) return NaN; |
| 66 return TO_INTEGER(hour) * msPerHour | 66 return TO_INTEGER(hour) * msPerHour |
| 67 + TO_INTEGER(min) * msPerMinute | 67 + TO_INTEGER(min) * msPerMinute |
| 68 + TO_INTEGER(sec) * msPerSecond | 68 + TO_INTEGER(sec) * msPerSecond |
| 69 + TO_INTEGER(ms); | 69 + TO_INTEGER(ms); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 // ECMA 262 - 15.9.1.12 | |
| 74 function TimeInYear(year) { | |
| 75 return DaysInYear(year) * msPerDay; | |
| 76 } | |
| 77 | |
| 78 | |
| 79 // Compute number of days given a year, month, date. | 73 // Compute number of days given a year, month, date. |
| 80 // Note that month and date can lie outside the normal range. | 74 // Note that month and date can lie outside the normal range. |
| 81 // For example: | 75 // For example: |
| 82 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20) | 76 // MakeDay(2007, -4, 20) --> MakeDay(2006, 8, 20) |
| 83 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1) | 77 // MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1) |
| 84 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11) | 78 // MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11) |
| 85 function MakeDay(year, month, date) { | 79 function MakeDay(year, month, date) { |
| 86 if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date)) return NaN; | 80 if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date)) return NaN; |
| 87 | 81 |
| 88 // Convert to integer and map -0 to 0. | 82 // Convert to integer and map -0 to 0. |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 "toUTCString", DateToUTCString, | 875 "toUTCString", DateToUTCString, |
| 882 "getYear", DateGetYear, | 876 "getYear", DateGetYear, |
| 883 "setYear", DateSetYear, | 877 "setYear", DateSetYear, |
| 884 "toISOString", DateToISOString, | 878 "toISOString", DateToISOString, |
| 885 "toJSON", DateToJSON | 879 "toJSON", DateToJSON |
| 886 ]); | 880 ]); |
| 887 | 881 |
| 888 %InstallToContext(["create_date_fun", CreateDate]); | 882 %InstallToContext(["create_date_fun", CreateDate]); |
| 889 | 883 |
| 890 }) | 884 }) |
| OLD | NEW |