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>
This commit is contained in:
parent
513d9bb8aa
commit
a08fcc02f8
@ -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}`;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user