Chromium Code Reviews| Index: chrome/browser/resources/memory_internals/memory_internals.js |
| diff --git a/chrome/browser/resources/memory_internals/memory_internals.js b/chrome/browser/resources/memory_internals/memory_internals.js |
| index 5bb10c7947a7d22f4f93c95640ee6e6799829065..ebadf515ea7f2134c358cc1952cad8b711d78cef 100644 |
| --- a/chrome/browser/resources/memory_internals/memory_internals.js |
| +++ b/chrome/browser/resources/memory_internals/memory_internals.js |
| @@ -30,8 +30,8 @@ var MainView = (function() { |
| $('os-value').textContent = browser['os'] + ' (' + |
| browser['os_version'] + ')'; |
| - $('uptime-value').textContent = Math.floor(browser['uptime'] / 1000) + |
| - ' sec'; |
| + $('uptime-value').textContent = |
| + secondsToHMS(Math.floor(browser['uptime'] / 1000)); |
| this.updateSnapshot(browser['processes']); |
| this.updateExtensions(browser['extensions']); |
| @@ -136,7 +136,7 @@ var MainView = (function() { |
| var history = tab['history'][l]; |
| var title = (history['title'] == '') ? history['url'] : history['title']; |
| var url = '<a href="' + history['url'] + '">' + HTMLEscape(title) + |
| - '</a> (' + history['time'] + ' sec. ago)'; |
| + '</a> (' + secondsToHMS(history['time']) + ' ago)'; |
| if (l == tab['index']) { |
| url = '<strong>' + url + '</strong>'; |
| } |
| @@ -154,3 +154,19 @@ var MainView = (function() { |
| document.addEventListener('DOMContentLoaded', function() { |
| g_main_view = new MainView(); |
| }); |
| + |
| +/** |
| + * Produces a readable string int the format '<HH> hours <MM> min. <SS> sec.' |
| + * representing the amount of time provided as the number of seconds. |
| + * @param {number} totalSeconds The total amount of seconds. |
| + * @return {string} The formatted HH hours/hours MM min. SS sec. string |
| + */ |
| +function secondsToHMS(totalSeconds) { |
|
Bernhard Bauer
2014/03/26 12:41:09
Move this into the anonymous function on lines 10
ltilve
2014/03/26 19:22:07
Done.
|
| + totalSeconds = Number(totalSeconds); |
| + var hour = Math.floor(totalSeconds / 3600); |
| + var min = Math.floor(totalSeconds % 3600 / 60); |
| + var sec = Math.floor(totalSeconds % 60); |
| + return (hour > 0 ? (hour + (hour > 1 ? ' hours ' : ' hour ')) : '') + |
| + (min > 0 ? (min + ' min. ') : '') + |
| + (sec + ' sec. '); |
| +} |