Afanasev_Stepan_PIbd-21_IP/ИП 3 лаба/node_modules/es-abstract/5/MakeTime.js
[USERNAME] 0dd26716dc Lab2-5
2024-01-10 16:11:49 +04:00

24 lines
698 B
JavaScript

'use strict';
var $isFinite = require('../helpers/isFinite');
var timeConstants = require('../helpers/timeConstants');
var msPerSecond = timeConstants.msPerSecond;
var msPerMinute = timeConstants.msPerMinute;
var msPerHour = timeConstants.msPerHour;
var ToInteger = require('./ToInteger');
// https://262.ecma-international.org/5.1/#sec-15.9.1.11
module.exports = function MakeTime(hour, min, sec, ms) {
if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) {
return NaN;
}
var h = ToInteger(hour);
var m = ToInteger(min);
var s = ToInteger(sec);
var milli = ToInteger(ms);
var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
return t;
};