Commit 2d2da5d2 authored by John Rummell's avatar John Rummell Committed by Commit Bot

Improve the ways timestamps are displayed on chrome://media-internals

Currently the timestamps are displayed with only 2 digits for the
millisecond field if it is less than 100 ms, resulting in misleading
numbers (e.g. 00:00:09 62). Updating the display to always show 3
digits for the milliseconds, and adding a period before
(e.g. 00:00:09.062).

BUG=
TEST=tested locally

Change-Id: I37e2cf375ce4311623e6a30271f495ebd0fc4d74
Reviewed-on: https://chromium-review.googlesource.com/c/1256205Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595909}
parent 86ffa594
...@@ -30,17 +30,19 @@ var util = (function() { ...@@ -30,17 +30,19 @@ var util = (function() {
} }
}; };
util.millisecondsToString = function(timeMillis) { util.millisecondsToString = function(timeMillis) {
function pad(num) { function pad(num, len) {
num = num.toString(); num = num.toString();
if (num.length < 2) { while (num.length < len) {
return '0' + num; num = '0' + num;
} }
return num; return num;
} }
var date = new Date(timeMillis); var date = new Date(timeMillis);
return pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + return pad(date.getUTCHours(), 2) + ':' +
pad(date.getUTCSeconds()) + ' ' + pad((date.getMilliseconds()) % 1000); pad(date.getUTCMinutes(), 2) + ':' +
pad(date.getUTCSeconds(), 2) + '.' +
pad((date.getMilliseconds()) % 1000, 3);
}; };
return util; return util;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment