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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/memory_internals/memory_internals.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 <include src="assert.js"> 5 <include src="assert.js">
6 6
7 /** 7 /**
8 * The global object. 8 * The global object.
9 * @type {!Object} 9 * @type {!Object}
10 * @const 10 * @const
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 * @param {number} maxLength The maximum length allowed for the string. 417 * @param {number} maxLength The maximum length allowed for the string.
418 * @return {string} The original string if its length does not exceed 418 * @return {string} The original string if its length does not exceed
419 * |maxLength|. Otherwise the first |maxLength| - 1 characters with '...' 419 * |maxLength|. Otherwise the first |maxLength| - 1 characters with '...'
420 * appended. 420 * appended.
421 */ 421 */
422 function elide(original, maxLength) { 422 function elide(original, maxLength) {
423 if (original.length <= maxLength) 423 if (original.length <= maxLength)
424 return original; 424 return original;
425 return original.substring(0, maxLength - 1) + '\u2026'; 425 return original.substring(0, maxLength - 1) + '\u2026';
426 } 426 }
427
428
429 /**
430 * Produces a readable HH hours MM min. SS sec. string representing
431 * the amount of time provided as the number of seconds.
432 * @param {number} totalSeconds The total amount of seconds.
433 * @return {string} The formatted HH hours/hours MM min. SS sec. string
434 */
435 function secondsToHMS(totalSeconds)
436 {
437 totalSeconds = Number(totalSeconds);
438 var hour = Math.floor(totalSeconds / 3600);
439 var min = Math.floor(totalSeconds % 3600 / 60);
440 var sec = Math.floor(totalSeconds % 3600 % 60);
peria 2014/03/23 15:16:27 remove "% 3600"
441 return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') +
442 (min > 0 ? (min + ' min. '): '' ) +
443 (sec + ' sec. '));
444 }
OLDNEW
« 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