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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Date/15.9.1.1-2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.9.1.1-2.js
    1.12 +   ECMA Section:       15.9.1.1 Time Range
    1.13 +   Description:
    1.14 +   - leap seconds are ignored
    1.15 +   - assume 86400000 ms / day
    1.16 +   - numbers range fom +/- 9,007,199,254,740,991
    1.17 +   - ms precision for any instant that is within
    1.18 +   approximately +/-285,616 years from 1 jan 1970
    1.19 +   UTC
    1.20 +   - range of times supported is -100,000,000 days
    1.21 +   to 100,000,000 days from 1 jan 1970 12:00 am
    1.22 +   - time supported is 8.64e5*10e8 milliseconds from
    1.23 +   1 jan 1970 UTC  (+/-273972.6027397 years)
    1.24 +   Author:             christine@netscape.com
    1.25 +   Date:               9 july 1997
    1.26 +*/
    1.27 +
    1.28 +//  every one hundred years contains:
    1.29 +//    24 years with 366 days
    1.30 +//
    1.31 +//  every four hundred years contains:
    1.32 +//    97 years with 366 days
    1.33 +//   303 years with 365 days
    1.34 +//
    1.35 +//   86400000*366*97  =    3067372800000
    1.36 +//  +86400000*365*303 =  + 9555408000000
    1.37 +//                    =    1.26227808e+13
    1.38 +
    1.39 +var FOUR_HUNDRED_YEARS = 1.26227808e+13;
    1.40 +var SECTION         =  "15.9.1.1-2";
    1.41 +
    1.42 +writeHeaderToLog("15.9.1.1 Time Range");
    1.43 +
    1.44 +var M_SECS;
    1.45 +var CURRENT_YEAR;
    1.46 +
    1.47 +for ( M_SECS = 0, CURRENT_YEAR = 1970;
    1.48 +      M_SECS > -8640000000000000;
    1.49 +      M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
    1.50 +
    1.51 +  new TestCase( SECTION,
    1.52 +		"new Date("+M_SECS+")",
    1.53 +		CURRENT_YEAR,
    1.54 +		(new Date( M_SECS )).getUTCFullYear() );
    1.55 +
    1.56 +}
    1.57 +
    1.58 +test();
    1.59 +

mercurial