|
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-1.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 |
|
22 - this test generates its own data -- it does not |
|
23 read data from a file. |
|
24 Author: christine@netscape.com |
|
25 Date: 7 july 1997 |
|
26 |
|
27 Static variables: |
|
28 FOUR_HUNDRED_YEARS |
|
29 |
|
30 */ |
|
31 |
|
32 // every one hundred years contains: |
|
33 // 24 years with 366 days |
|
34 // |
|
35 // every four hundred years contains: |
|
36 // 97 years with 366 days |
|
37 // 303 years with 365 days |
|
38 // |
|
39 // 86400000*365*97 = 3067372800000 |
|
40 // +86400000*366*303 = + 9555408000000 |
|
41 // = 1.26227808e+13 |
|
42 var FOUR_HUNDRED_YEARS = 1.26227808e+13; |
|
43 var SECTION = "15.9.1.1-1"; |
|
44 |
|
45 writeHeaderToLog("15.9.1.1 Time Range"); |
|
46 |
|
47 var M_SECS; |
|
48 var CURRENT_YEAR; |
|
49 |
|
50 for ( M_SECS = 0, CURRENT_YEAR = 1970; |
|
51 M_SECS < 8640000000000000; |
|
52 M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) { |
|
53 |
|
54 new TestCase( SECTION, |
|
55 "new Date("+M_SECS+")", |
|
56 CURRENT_YEAR, |
|
57 (new Date( M_SECS)).getUTCFullYear() ); |
|
58 } |
|
59 |
|
60 test(); |
|
61 |