1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.secondsToTime = exports.timeToSeconds = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function timeToSeconds(time) {
|
10 | if (time) {
|
11 | return Math.floor(time.seconds + time.minutes * 60 + time.hours * 3600);
|
12 | }
|
13 | throw Error('The given time is not valid.');
|
14 | }
|
15 | exports.timeToSeconds = timeToSeconds;
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function secondsToTime(n) {
|
22 | if (n <= 0) {
|
23 | return { hours: 0, minutes: 0, seconds: 0 };
|
24 | }
|
25 | var hours = Math.floor(n / 3600);
|
26 | var restFromHours = n % 3600;
|
27 | var minutes = Math.floor(restFromHours / 60);
|
28 | var seconds = restFromHours % 60;
|
29 | return { hours: hours, minutes: minutes, seconds: seconds };
|
30 | }
|
31 | exports.secondsToTime = secondsToTime;
|
32 |
|
\ | No newline at end of file |