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

Unified Diff: base/time/time.h

Issue 1824673002: time: Add a static TimeTicks method that returns the underlying clock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed to GetClock and an enum Created 4 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 | « no previous file | base/time/time_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time.h
diff --git a/base/time/time.h b/base/time/time.h
index 066d910833d2091e60a97870daf0aa7c800dc630..720f9a46efddc26c0b26d4c2d93bc5279f9f4911 100644
--- a/base/time/time.h
+++ b/base/time/time.h
@@ -642,6 +642,16 @@ BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time);
// Represents monotonically non-decreasing clock time.
class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> {
public:
+ // The underlying clock used to generate new TimeTicks.
+ enum class Clock {
+ UNKNOWN,
danakj 2016/03/30 19:51:58 Not sure that you really need the UNKNOWN here. It
charliea (OOO until 10-5) 2016/03/30 20:07:44 Done.
+ LINUX_CLOCK_MONOTONIC,
+ IOS_CF_ABSOLUTE_TIME_MINUS_KERN_BOOTTIME,
+ MAC_MACH_ABSOLUTE_TIME,
+ WIN_QPC,
+ WIN_ROLLOVER_PROTECTED_TIME_GET_TIME
+ };
+
TimeTicks() : TimeBase(0) {
}
@@ -680,6 +690,11 @@ class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> {
TimeTicks SnappedToNextTick(TimeTicks tick_phase,
TimeDelta tick_interval) const;
+ // Returns an enum indicating the underlying clock being used to generate
+ // TimeTicks timestamps. This function should only be used for debugging and
+ // logging purposes.
+ static Clock GetClock();
+
#if defined(OS_WIN)
protected:
typedef DWORD (*TickFunctionType)(void);
« no previous file with comments | « no previous file | base/time/time_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698