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

Side by Side Diff: chrome/browser/resources/net_internals/time_util.js

Issue 2602473003: Run tools/clang-format-js on chrome/browser/resources/net_internals (Closed)
Patch Set: drop dep Created 3 years, 11 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
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 var timeutil = (function() { 5 var timeutil = (function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Offset needed to convert event times to Date objects. 9 * Offset needed to convert event times to Date objects.
10 * Updated whenever constants are loaded. 10 * Updated whenever constants are loaded.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return span; 125 return span;
126 } 126 }
127 127
128 /** 128 /**
129 * Returns a string representation of |date|. 129 * Returns a string representation of |date|.
130 * 130 *
131 * @param {Date} date The date to be represented. 131 * @param {Date} date The date to be represented.
132 * @return {string} A string representation of |date|. 132 * @return {string} A string representation of |date|.
133 */ 133 */
134 function dateToString(date) { 134 function dateToString(date) {
135 var dateStr = date.getFullYear() + '-' + 135 var dateStr = date.getFullYear() + '-' + zeroPad_(date.getMonth() + 1, 2) +
136 zeroPad_(date.getMonth() + 1, 2) + '-' + 136 '-' + zeroPad_(date.getDate(), 2);
137 zeroPad_(date.getDate(), 2);
138 137
139 var timeStr = zeroPad_(date.getHours(), 2) + ':' + 138 var timeStr = zeroPad_(date.getHours(), 2) + ':' +
140 zeroPad_(date.getMinutes(), 2) + ':' + 139 zeroPad_(date.getMinutes(), 2) + ':' + zeroPad_(date.getSeconds(), 2) +
141 zeroPad_(date.getSeconds(), 2) + '.' + 140 '.' + zeroPad_(date.getMilliseconds(), 3);
142 zeroPad_(date.getMilliseconds(), 3);
143 141
144 return dateStr + ' ' + timeStr; 142 return dateStr + ' ' + timeStr;
145 } 143 }
146 144
147 /** 145 /**
148 * Prefixes enough zeros to |num| so that it has length |len|. 146 * Prefixes enough zeros to |num| so that it has length |len|.
149 * @param {number} num The number to be padded. 147 * @param {number} num The number to be padded.
150 * @param {number} len The desired length of the returned string. 148 * @param {number} len The desired length of the returned string.
151 * @return {string} The zero-padded representation of |num|. 149 * @return {string} The zero-padded representation of |num|.
152 */ 150 */
(...skipping 12 matching lines...) Expand all
165 getCurrentTimeTicks: getCurrentTimeTicks, 163 getCurrentTimeTicks: getCurrentTimeTicks,
166 setBaseTime: setBaseTime, 164 setBaseTime: setBaseTime,
167 getBaseTime: getBaseTime, 165 getBaseTime: getBaseTime,
168 clearBaseTime: clearBaseTime, 166 clearBaseTime: clearBaseTime,
169 isBaseTimeSet: isBaseTimeSet, 167 isBaseTimeSet: isBaseTimeSet,
170 convertTimeTicksToRelativeTime: convertTimeTicksToRelativeTime, 168 convertTimeTicksToRelativeTime: convertTimeTicksToRelativeTime,
171 addNodeWithDate: addNodeWithDate, 169 addNodeWithDate: addNodeWithDate,
172 dateToString: dateToString, 170 dateToString: dateToString,
173 }; 171 };
174 })(); 172 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698