From 382d5afc7e2ac24f67b7c891328b8b9bb7e91058 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jul 2021 23:14:20 -0300 Subject: timestamp files!!! --- general-util.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'general-util.js') diff --git a/general-util.js b/general-util.js index 0a81cdc..f63ae21 100644 --- a/general-util.js +++ b/general-util.js @@ -139,6 +139,16 @@ module.exports.throttlePromise = function(maximumAtOneTime = 10) { return enqueue } +module.exports.getSecFromTimestamp = function(timestamp) { + const parts = timestamp.split(':').map(n => parseInt(n)) + switch (parts.length) { + case 3: return parts[0] * 3600 + parts[1] * 60 + parts[2] + case 2: return parts[0] * 60 + parts[1] + case 1: return parts[0] + default: return 0 + } +} + module.exports.getTimeStringsFromSec = function(curSecTotal, lenSecTotal) { const percentVal = (100 / lenSecTotal) * curSecTotal const percentDone = ( -- cgit 1.3.0-6-gf8a5