OLD | NEW |
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 Loading... |
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 Loading... |
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 })(); |
OLD | NEW |