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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // ECMA 262 - 15.9.1.2 | 44 // ECMA 262 - 15.9.1.2 |
45 function Day(time) { | 45 function Day(time) { |
46 return FLOOR(time/msPerDay); | 46 return FLOOR(time/msPerDay); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 // ECMA 262 - 5.2 | 50 // ECMA 262 - 5.2 |
51 function Modulo(value, remainder) { | 51 function Modulo(value, remainder) { |
52 var mod = value % remainder; | 52 var mod = value % remainder; |
| 53 // Guard against returning -0. |
| 54 if (mod == 0) return 0; |
53 return mod >= 0 ? mod : mod + remainder; | 55 return mod >= 0 ? mod : mod + remainder; |
54 } | 56 } |
55 | 57 |
56 | 58 |
57 function TimeWithinDay(time) { | 59 function TimeWithinDay(time) { |
58 return Modulo(time, msPerDay); | 60 return Modulo(time, msPerDay); |
59 } | 61 } |
60 | 62 |
61 | 63 |
62 // ECMA 262 - 15.9.1.3 | 64 // ECMA 262 - 15.9.1.3 |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 "setFullYear", DateSetFullYear, | 1028 "setFullYear", DateSetFullYear, |
1027 "setUTCFullYear", DateSetUTCFullYear, | 1029 "setUTCFullYear", DateSetUTCFullYear, |
1028 "toGMTString", DateToGMTString, | 1030 "toGMTString", DateToGMTString, |
1029 "toUTCString", DateToUTCString, | 1031 "toUTCString", DateToUTCString, |
1030 "getYear", DateGetYear, | 1032 "getYear", DateGetYear, |
1031 "setYear", DateSetYear | 1033 "setYear", DateSetYear |
1032 )); | 1034 )); |
1033 } | 1035 } |
1034 | 1036 |
1035 SetupDate(); | 1037 SetupDate(); |
OLD | NEW |