summaryrefslogtreecommitdiff
path: root/benchmark/_benchmark_progress.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-02-08 03:27:35 -0500
committerJames M Snell <jasnell@gmail.com>2017-02-16 16:22:56 -0800
commita08fcc02f8549635d6c79c11545777ce07ec185a (patch)
tree296bb8a74aa1457bbe4e7fcf44b86efa45b024a9 /benchmark/_benchmark_progress.js
parent513d9bb8aa53feb6630ac56fc231e846d928804f (diff)
downloadandroid-node-v8-a08fcc02f8549635d6c79c11545777ce07ec185a.tar.gz
android-node-v8-a08fcc02f8549635d6c79c11545777ce07ec185a.tar.bz2
android-node-v8-a08fcc02f8549635d6c79c11545777ce07ec185a.zip
benchmark: fix timer display in progress output
This commit fixes an issue where the minutes would not display properly on the benchmark timer once an hour had elapsed. PR-URL: https://github.com/nodejs/node/pull/11235 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/_benchmark_progress.js')
-rw-r--r--benchmark/_benchmark_progress.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/benchmark/_benchmark_progress.js b/benchmark/_benchmark_progress.js
index 2a2a458c5c..4b42248f24 100644
--- a/benchmark/_benchmark_progress.js
+++ b/benchmark/_benchmark_progress.js
@@ -15,9 +15,9 @@ function fraction(numerator, denominator) {
function getTime(diff) {
const time = Math.ceil(diff[0] + diff[1] / 1e9);
- const seconds = pad(time % 60, 2, '0');
- const minutes = pad(Math.floor(time / 60) % (60 * 60), 2, '0');
- const hours = pad(Math.floor(time / (60 * 60)), 2, '0');
+ const hours = pad(Math.floor(time / 3600), 2, '0');
+ const minutes = pad(Math.floor((time % 3600) / 60), 2, '0');
+ const seconds = pad((time % 3600) % 60, 2, '0');
return `${hours}:${minutes}:${seconds}`;
}