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..7c5ae929700f6a02cb58fabf65e4de35e7faa198 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 |
Bernhard Bauer
2014/03/25 16:36:10
Nit: This sentence reads a big bumpy. How about "[
|
+ * 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) |
+{ |
arv (Not doing code reviews)
2014/03/25 16:34:40
{ on previous line
Bernhard Bauer
2014/03/25 16:36:10
Opening braces goes on the previous line.
|
+ 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 ')) : '') + |
arv (Not doing code reviews)
2014/03/25 16:34:40
Maybe use Intl.DateTimeFormat instead?
arv (Not doing code reviews)
2014/03/25 16:34:40
too many parentheses (the return expression is wra
Bernhard Bauer
2014/03/25 16:36:10
This is of course an i18n nightmare. But the page
arv (Not doing code reviews)
2014/03/25 16:38:15
I didn't even notice that this was in util.js
Ple
|
+ (min > 0 ? (min + ' min. '): '' ) + |
+ (sec + ' sec. ')); |
+} |