js/src/tests/ecma/Date/15.9.1.1-2.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:44a535de3e80
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /**
8 File Name: 15.9.1.1-2.js
9 ECMA Section: 15.9.1.1 Time Range
10 Description:
11 - leap seconds are ignored
12 - assume 86400000 ms / day
13 - numbers range fom +/- 9,007,199,254,740,991
14 - ms precision for any instant that is within
15 approximately +/-285,616 years from 1 jan 1970
16 UTC
17 - range of times supported is -100,000,000 days
18 to 100,000,000 days from 1 jan 1970 12:00 am
19 - time supported is 8.64e5*10e8 milliseconds from
20 1 jan 1970 UTC (+/-273972.6027397 years)
21 Author: christine@netscape.com
22 Date: 9 july 1997
23 */
24
25 // every one hundred years contains:
26 // 24 years with 366 days
27 //
28 // every four hundred years contains:
29 // 97 years with 366 days
30 // 303 years with 365 days
31 //
32 // 86400000*366*97 = 3067372800000
33 // +86400000*365*303 = + 9555408000000
34 // = 1.26227808e+13
35
36 var FOUR_HUNDRED_YEARS = 1.26227808e+13;
37 var SECTION = "15.9.1.1-2";
38
39 writeHeaderToLog("15.9.1.1 Time Range");
40
41 var M_SECS;
42 var CURRENT_YEAR;
43
44 for ( M_SECS = 0, CURRENT_YEAR = 1970;
45 M_SECS > -8640000000000000;
46 M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
47
48 new TestCase( SECTION,
49 "new Date("+M_SECS+")",
50 CURRENT_YEAR,
51 (new Date( M_SECS )).getUTCFullYear() );
52
53 }
54
55 test();
56

mercurial