| 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 | gTestfile = '15.9.1.1-2.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 15.9.1.1-2.js |
| 10 | ECMA Section: 15.9.1.1 Time Range |
| 11 | Description: |
| 12 | - leap seconds are ignored |
| 13 | - assume 86400000 ms / day |
| 14 | - numbers range fom +/- 9,007,199,254,740,991 |
| 15 | - ms precision for any instant that is within |
| 16 | approximately +/-285,616 years from 1 jan 1970 |
| 17 | UTC |
| 18 | - range of times supported is -100,000,000 days |
| 19 | to 100,000,000 days from 1 jan 1970 12:00 am |
| 20 | - time supported is 8.64e5*10e8 milliseconds from |
| 21 | 1 jan 1970 UTC (+/-273972.6027397 years) |
| 22 | Author: [email protected] |
| 23 | Date: 9 july 1997 |
| 24 | */ |
| 25 | |
| 26 | // every one hundred years contains: |
| 27 | // 24 years with 366 days |
| 28 | // |
| 29 | // every four hundred years contains: |
| 30 | // 97 years with 366 days |
| 31 | // 303 years with 365 days |
| 32 | // |
| 33 | // 86400000*366*97 = 3067372800000 |
| 34 | // +86400000*365*303 = + 9555408000000 |
| 35 | // = 1.26227808e+13 |
| 36 | |
| 37 | var FOUR_HUNDRED_YEARS = 1.26227808e+13; |
| 38 | var SECTION = "15.9.1.1-2"; |
| 39 | |
| 40 | writeHeaderToLog("15.9.1.1 Time Range"); |
| 41 | |
| 42 | var M_SECS; |
| 43 | var CURRENT_YEAR; |
| 44 | |
| 45 | for ( M_SECS = 0, CURRENT_YEAR = 1970; |
| 46 | M_SECS > -8640000000000000; |
| 47 | M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) { |
| 48 | |
| 49 | new TestCase( SECTION, |
| 50 | "new Date("+M_SECS+")", |
| 51 | CURRENT_YEAR, |
| 52 | (new Date( M_SECS )).getUTCFullYear() ); |
| 53 | |
| 54 | } |
| 55 | |
| 56 | test(); |
| 57 |