tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

overflow-make-time.js (1477B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-date.utc
      5 description: Values specified to MakeTime exceed their time boundaries
      6 info: |
      7  [...]
      8  9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))). 
      9 
     10  MakeTime (hour, min, sec, ms)
     11 
     12  1. If hour is not finite or min is not finite or sec is not finite or ms is
     13     not finite, return NaN.
     14  2. Let h be ToInteger(hour).
     15  3. Let m be ToInteger(min).
     16  4. Let s be ToInteger(sec).
     17  5. Let milli be ToInteger(ms).
     18  6. Let t be h * msPerHour + m * msPerMinute + s * msPerSecond + milli,
     19     performing the arithmetic according to IEEE 754-2008 rules (that is, as if
     20     using the ECMAScript operators * and +).
     21  7. Return t.
     22 ---*/
     23 
     24 assert.sameValue(Date.UTC(2016, 6, 5, -1), 1467673200000, 'hour: -1');
     25 assert.sameValue(Date.UTC(2016, 6, 5, 24), 1467763200000, 'hour: 24');
     26 assert.sameValue(Date.UTC(2016, 6, 5, 0, -1), 1467676740000, 'minute: -1');
     27 assert.sameValue(Date.UTC(2016, 6, 5, 0, 60), 1467680400000, 'minute: 60');
     28 assert.sameValue(Date.UTC(2016, 6, 5, 0, 0, -1), 1467676799000, 'second: -1');
     29 assert.sameValue(Date.UTC(2016, 6, 5, 0, 0, 60), 1467676860000, 'second: 60');
     30 assert.sameValue(
     31  Date.UTC(2016, 6, 5, 0, 0, 0, -1), 1467676799999, 'millisecond: -1'
     32 );
     33 assert.sameValue(
     34  Date.UTC(2016, 6, 5, 0, 0, 0, 1000), 1467676801000, 'millisecond: 1000'
     35 );
     36 
     37 reportCompare(0, 0);