From c57de1878164f8b41239215ff15483d09be716e1 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Mon, 16 Jan 2017 16:55:58 -0500 Subject: [PATCH] Bug 1331495 - Add an operator<< overload for TimeDuration. r=froydnj MozReview-Commit-ID: dYKdlKI8Le --HG-- extra : rebase_source : a56ed17f1c505ca50e3a9bb9ad0e34a1060ef1ac --- mozglue/misc/TimeStamp.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mozglue/misc/TimeStamp.h b/mozglue/misc/TimeStamp.h index 9ff0c25c5c41..3d8ddcedcd3a 100644 --- a/mozglue/misc/TimeStamp.h +++ b/mozglue/misc/TimeStamp.h @@ -9,6 +9,7 @@ #include #include // for std::min, std::max +#include #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/FloatingPoint.h" @@ -279,6 +280,11 @@ public: return mValue != 0; } + friend std::ostream& operator<<(std::ostream& aStream, + const BaseTimeDuration& aDuration) { + return aStream << aDuration.ToMilliseconds() << " ms"; + } + // Return a best guess at the system's current timing resolution, // which might be variable. BaseTimeDurations below this order of // magnitude are meaningless, and those at the same order of