js/src/tests/ecma/Date/15.9.1.1-2.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.

     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/. */
     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 */
    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
    36 var FOUR_HUNDRED_YEARS = 1.26227808e+13;
    37 var SECTION         =  "15.9.1.1-2";
    39 writeHeaderToLog("15.9.1.1 Time Range");
    41 var M_SECS;
    42 var CURRENT_YEAR;
    44 for ( M_SECS = 0, CURRENT_YEAR = 1970;
    45       M_SECS > -8640000000000000;
    46       M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
    48   new TestCase( SECTION,
    49 		"new Date("+M_SECS+")",
    50 		CURRENT_YEAR,
    51 		(new Date( M_SECS )).getUTCFullYear() );
    53 }
    55 test();

mercurial