Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Unified Diff: ui/webui/resources/js/util.js

Issue 208833003: Show time in hours, minutes and seconds in chrome://memory-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/memory_internals/memory_internals.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/util.js
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js
index 56e2d2d283c0334f0dd4c6dd5f31bf0957deb38d..246d647628849e87fa88c8527a0ef13854e50a61 100644
--- a/ui/webui/resources/js/util.js
+++ b/ui/webui/resources/js/util.js
@@ -424,3 +424,21 @@ function elide(original, maxLength) {
return original;
return original.substring(0, maxLength - 1) + '\u2026';
}
+
+
+/**
+ * Produces a readable HH hours MM min. SS sec. string 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)
+{
+ totalSeconds = Number(totalSeconds);
+ var hour = Math.floor(totalSeconds / 3600);
+ var min = Math.floor(totalSeconds % 3600 / 60);
+ var sec = Math.floor(totalSeconds % 3600 % 60);
peria 2014/03/23 15:16:27 remove "% 3600"
+ return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') +
+ (min > 0 ? (min + ' min. '): '' ) +
+ (sec + ' sec. '));
+}
« no previous file with comments | « chrome/browser/resources/memory_internals/memory_internals.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698