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://ecma-international.org/ecma-262/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
|
};
|