Index: base/time/time.h |
diff --git a/base/time/time.h b/base/time/time.h |
index 40566b92317a3c94ff183994a22c0029122fceb0..83781c5b4e5d0c25ae1b122bfb1deb6dbb02fa13 100644 |
--- a/base/time/time.h |
+++ b/base/time/time.h |
@@ -47,6 +47,7 @@ |
#endif |
#include <limits> |
+#include <ostream> |
namespace base { |
@@ -613,6 +614,14 @@ class BASE_EXPORT TimeTicks { |
// application runs. |
static TimeTicks UnixEpoch(); |
+ // Converts time to/from a double which is the number of seconds since epoch |
+ // (Jan 1, 1970). Webkit uses this format to represent time. |
jamesr
2014/02/28 00:58:16
if this is just needed for interacting with Blink
|
+ // Because WebKit initializes double time value to 0 to indicate "not |
+ // initialized", we map it to empty Time object that also means "not |
+ // initialized". |
+ static TimeTicks FromWebKit(double dt); |
+ double ToWebKit() const; |
+ |
// Returns the internal numeric value of the TimeTicks object. |
// For serializing, use FromInternalValue to reconstitute. |
int64 ToInternalValue() const { |
@@ -688,6 +697,21 @@ inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
return TimeTicks(t.ticks_ + delta_); |
} |
+inline ::std::ostream& operator<<(::std::ostream& os, const TimeTicks& t) { |
+ os << "TimeTicks("; |
jamesr
2014/02/28 00:58:16
i'm pretty sure we don't want to have these stream
|
+ int64 ticks = t.ToInternalValue(); |
+ if (ticks == 0) |
+ ; |
+ else if (ticks == std::numeric_limits<int64>::max()) |
+ os << "max"; |
+ else if (ticks == std::numeric_limits<int64>::min()) |
+ os << "min"; |
+ else |
+ os << ticks; |
+ os << ")"; |
+ return os; |
+} |
+ |
} // namespace base |
#endif // BASE_TIME_TIME_H_ |