Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 /** | |
| 7 * @fileoverview A placeholder for google closure library functions. | |
|
scherkus (not reviewing)
2013/07/29 22:16:28
want to rename this file util.js and introduce hel
Ty Overby
2013/07/29 22:47:22
Done.
| |
| 8 */ | |
| 9 | |
| 10 var goog = {}; | |
| 11 goog.object = {}; | |
| 12 goog.object.forEach = function(obj, f, optObj) { | |
| 13 'use strict'; | |
| 14 var key; | |
| 15 for (key in obj) { | |
| 16 if (obj.hasOwnProperty(key)) { | |
| 17 f.call(optObj, obj[key], key, obj); | |
| 18 } | |
| 19 } | |
| 20 }; | |
| 21 | |
| 22 goog.time = {}; | |
| 23 goog.time.millisToString = function(timeMillis) { | |
|
scherkus (not reviewing)
2013/07/29 22:16:28
is this function used anywhere yet?
if not, pleas
Ty Overby
2013/07/29 22:47:22
Done.
| |
| 24 'use strict'; | |
| 25 function pad(num) { | |
| 26 num = num.toString(); | |
| 27 if (num.length < 2) { | |
| 28 return '0' + num; | |
| 29 } | |
| 30 return num; | |
| 31 } | |
| 32 | |
| 33 var date = new Date(timeMillis); | |
| 34 return pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + | |
| 35 pad(date.getUTCSeconds()) + ' ' + pad((date.getMilliseconds()) % 1000); | |
| 36 }; | |
| OLD | NEW |