main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
698 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $isFinite = require('../helpers/isFinite');
|
---|
4 | var timeConstants = require('../helpers/timeConstants');
|
---|
5 | var msPerSecond = timeConstants.msPerSecond;
|
---|
6 | var msPerMinute = timeConstants.msPerMinute;
|
---|
7 | var msPerHour = timeConstants.msPerHour;
|
---|
8 |
|
---|
9 | var ToInteger = require('./ToInteger');
|
---|
10 |
|
---|
11 | // https://262.ecma-international.org/5.1/#sec-15.9.1.11
|
---|
12 |
|
---|
13 | module.exports = function MakeTime(hour, min, sec, ms) {
|
---|
14 | if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) {
|
---|
15 | return NaN;
|
---|
16 | }
|
---|
17 | var h = ToInteger(hour);
|
---|
18 | var m = ToInteger(min);
|
---|
19 | var s = ToInteger(sec);
|
---|
20 | var milli = ToInteger(ms);
|
---|
21 | var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
|
---|
22 | return t;
|
---|
23 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.