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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial