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

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

Issue 16228003: Use Date.now() rather than new Date().getTime(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 function convertTimeTicksToDate(timeTicks) { 42 function convertTimeTicksToDate(timeTicks) {
43 return new Date(convertTimeTicksToTime(timeTicks)); 43 return new Date(convertTimeTicksToTime(timeTicks));
44 } 44 }
45 45
46 /** 46 /**
47 * Returns the current time. 47 * Returns the current time.
48 * 48 *
49 * @return {number} Milliseconds since the Unix epoch. 49 * @return {number} Milliseconds since the Unix epoch.
50 */ 50 */
51 function getCurrentTime() { 51 function getCurrentTime() {
52 return (new Date()).getTime(); 52 return Date.now();
53 } 53 }
54 54
55 /** 55 /**
56 * Adds an HTML representation of |date| to |parentNode|. 56 * Adds an HTML representation of |date| to |parentNode|.
57 * 57 *
58 * @param {DomNode} parentNode The node that will contain the new node. 58 * @param {DomNode} parentNode The node that will contain the new node.
59 * @param {Date} date The date to be displayed. 59 * @param {Date} date The date to be displayed.
60 * @return {DomNode} The new node containing the date/time. 60 * @return {DomNode} The new node containing the date/time.
61 */ 61 */
62 function addNodeWithDate(parentNode, date) { 62 function addNodeWithDate(parentNode, date) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 return { 100 return {
101 setTimeTickOffset: setTimeTickOffset, 101 setTimeTickOffset: setTimeTickOffset,
102 convertTimeTicksToTime: convertTimeTicksToTime, 102 convertTimeTicksToTime: convertTimeTicksToTime,
103 convertTimeTicksToDate: convertTimeTicksToDate, 103 convertTimeTicksToDate: convertTimeTicksToDate,
104 getCurrentTime: getCurrentTime, 104 getCurrentTime: getCurrentTime,
105 addNodeWithDate: addNodeWithDate, 105 addNodeWithDate: addNodeWithDate,
106 dateToString: dateToString 106 dateToString: dateToString
107 }; 107 };
108 })(); 108 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698