[sched] Update lib.js

Correct `decodeTime(t)` to return a more likely expected time:
- before: `require("sched").decodeTime(60*60*1000-1)` returns: `{ hrs: 0, mins: 60 }`
- after: `require("sched").decodeTime(60*60*1000-1)` returns: `{ hrs: 1, mins: 0 }`
pull/1728/head
storm64 2022-04-21 22:05:12 +02:00 committed by GitHub
parent b7b64c2cfe
commit 662581bff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -110,9 +110,9 @@ exports.setSettings = function(settings) {
// time in ms -> { hrs, mins } // time in ms -> { hrs, mins }
exports.decodeTime = function(t) { exports.decodeTime = function(t) {
t = 0 | t; // sanitise t = Math.ceil(t / 60000); // sanitise to full minutes
let hrs = 0 | (t / 3600000); let hrs = 0 | (t / 60);
return { hrs: hrs, mins: Math.round((t - hrs * 3600000) / 60000) }; return { hrs: hrs, mins: t - hrs * 60;
} }
// time in { hrs, mins } -> ms // time in { hrs, mins } -> ms