diff --git a/res/include/script/dependencies/util.js b/res/include/script/dependencies/util.js index 769ae7f..c3c516f 100644 --- a/res/include/script/dependencies/util.js +++ b/res/include/script/dependencies/util.js @@ -70,3 +70,16 @@ function formatDataVolume(amt, precision) { } return amt + " B" } + +const second = 1000 +const minute = second*60 +const hour = minute*60 +const day = hour*24 + +function formatDuration(ms) { + let res = "" + if (ms >= day) { res += Math.floor(ms/day) + "d " } + if (ms >= hour) { res += Math.floor((ms%day)/hour) + "h " } + if (ms >= minute) { res += Math.floor((ms%hour)/minute) + "m " } + return res + ((ms%minute)/second).toFixed(3) + "s" +} diff --git a/res/template/admin.html b/res/template/admin.html index e84eee5..7b92541 100644 --- a/res/template/admin.html +++ b/res/template/admin.html @@ -187,8 +187,8 @@ row.innerHTML = `\