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

Unified Diff: Source/devtools/front_end/utilities.js

Issue 185713007: DevTools: Add timestamp support in the console (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/inspector.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/utilities.js
diff --git a/Source/devtools/front_end/utilities.js b/Source/devtools/front_end/utilities.js
index bd98244bd26729eb527f1aa6795b0a2a6a4da7af..78723ec5dcdede5294ac27f63f26bb9e7468400c 100644
--- a/Source/devtools/front_end/utilities.js
+++ b/Source/devtools/front_end/utilities.js
@@ -370,6 +370,38 @@ Date.prototype.toISO8601Compact = function()
leadZero(this.getSeconds());
}
+/**
+ * @return {string}
+ */
+ Date.prototype.toConsoleTime = function()
+{
+ /**
+ * @param {number} x
+ * @return {string}
+ */
+ function leadZero2(x)
+ {
+ return (x > 9 ? "" : "0") + x;
+ }
+
+ /**
+ * @param {number} x
+ * @return {string}
+ */
+ function leadZero3(x)
+ {
+ return (Array(4 - x.toString().length)).join('0') + x;
+ }
+
+ return this.getFullYear() + "-" +
+ leadZero2(this.getMonth() + 1) + "-" +
+ leadZero2(this.getDate()) + " " +
+ leadZero2(this.getHours()) + ":" +
+ leadZero2(this.getMinutes()) + ":" +
+ leadZero2(this.getSeconds()) + "." +
+ leadZero3(this.getMilliseconds());
+}
+
Object.defineProperty(Array.prototype, "remove",
{
/**
« no previous file with comments | « Source/devtools/front_end/inspector.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698