summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Bhardwaj <abhishekbh@google.com>2018-01-19 05:02:36 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-01-19 05:02:36 +0000
commit4b839b8736407850125f53695db1aa2d7db6be06 (patch)
tree823e9f72c665ec6294615787fff50f122b2c159f
parent0aadcf017be095febbc91bce9a4dbaa3bc5c0383 (diff)
parent280be925a9a97e51ceb11a84560a958348f14efd (diff)
downloadlibchrome-4b839b8736407850125f53695db1aa2d7db6be06.tar.gz
libchrome: Add since_origin API to TimeBase am: 913d8c2b1f
am: 280be925a9 Change-Id: I4ca4bc7ee2060cb9562a78b88f2e6bf50d4d2790
-rw-r--r--base/time/time.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/time/time.h b/base/time/time.h
index ff8bdde3dc..46aa9454d9 100644
--- a/base/time/time.h
+++ b/base/time/time.h
@@ -341,6 +341,14 @@ class TimeBase {
// provided operators.
int64_t ToInternalValue() const { return us_; }
+ // The amount of time since the origin (or "zero") point. This is a syntactic
+ // convenience to aid in code readability, mainly for debugging/testing use
+ // cases.
+ //
+ // Warning: While the Time subclass has a fixed origin point, the origin for
+ // the other subclasses can vary each time the application is restarted.
+ TimeDelta since_origin() const { return TimeDelta::FromMicroseconds(us_); }
+
TimeClass& operator=(TimeClass other) {
us_ = other.us_;
return *(static_cast<TimeClass*>(this));