diff options
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 8212b62f..e3fa3892 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -64,6 +64,17 @@ export var tools = new function() { } }; + this.formatDuration = function(duration) { + let millis = parseInt((duration % 1000) / 100); + let secs = Math.floor((duration / 1000) % 60); + let mins = Math.floor((duration / (1000 * 60)) % 60); + let hours = Math.floor((duration / (1000 * 60 * 60)) % 24); + hours = (hours < 10 ? "0" + hours : hours); + mins = (mins < 10 ? "0" + mins : mins); + secs = (secs < 10 ? "0" + secs : secs); + return `${hours}:${mins}:${secs}.${millis}`; + }; + /************************************************************************/ this.getCookie = function(name) { |