Flutter Engine
fml::TimePoint Class Reference

#include <time_point.h>

Public Member Functions

constexpr TimePoint ()=default
 
TimeDelta ToEpochDelta () const
 
TimeDelta operator- (TimePoint other) const
 
TimePoint operator+ (TimeDelta duration) const
 
TimePoint operator- (TimeDelta duration) const
 
bool operator== (TimePoint other) const
 
bool operator!= (TimePoint other) const
 
bool operator< (TimePoint other) const
 
bool operator<= (TimePoint other) const
 
bool operator> (TimePoint other) const
 
bool operator>= (TimePoint other) const
 

Static Public Member Functions

static TimePoint Now ()
 
static constexpr TimePoint Min ()
 
static constexpr TimePoint Max ()
 
static constexpr TimePoint FromEpochDelta (TimeDelta ticks)
 

Detailed Description

Definition at line 21 of file time_point.h.

Constructor & Destructor Documentation

◆ TimePoint()

constexpr fml::TimePoint::TimePoint ( )
default

Member Function Documentation

◆ FromEpochDelta()

◆ Max()

static constexpr TimePoint fml::TimePoint::Max ( )
inlinestatic

Definition at line 32 of file time_point.h.

References TimePoint().

Referenced by fml::MessageLoopTaskQueues::GetNextTaskToRun(), and fml::testing::TEST().

32  {
33  return TimePoint(std::numeric_limits<int64_t>::max());
34  }
constexpr TimePoint()=default

◆ Min()

static constexpr TimePoint fml::TimePoint::Min ( )
inlinestatic

Definition at line 28 of file time_point.h.

References TimePoint().

28  {
29  return TimePoint(std::numeric_limits<int64_t>::min());
30  }
constexpr TimePoint()=default

◆ Now()

TimePoint fml::TimePoint::Now ( )
static

Definition at line 26 of file time_point.cc.

References TimePoint().

Referenced by VSyncClient::await, flutter::testing::ShellTestVsyncWaiter::AwaitVSync(), fml::benchmarking::BM_RegisterAndGetTasks(), flutter_runner::SessionConnection::CalculateNextLatchPoint(), flutter::testing::PendingTests::CheckTimedOutTests(), fml::testing::CountRemainingTasks(), flutter::Stopwatch::CurrentLap(), fml::MessageLoopImpl::DoTerminate(), flutter::Rasterizer::Draw(), flutter::PersistentCache::DumpSkp(), FlutterEngineGetCurrentTime(), flutter::FxlToDartOrEarlier(), flutter::EmbedderTaskRunner::GetEmbedderIdentifier(), flutter::testing::GetTestNameFromTestInfo(), fml::TaskRunner::PostDelayedTask(), fml::TaskRunner::PostTask(), flutter_runner::SessionConnection::Present(), flutter::LayerTree::RecordBuildTime(), flutter_runner::VsyncWaiter::SnapToNextPhase(), flutter::Stopwatch::Start(), flutter::Stopwatch::Stop(), flutter_runner_test::TEST(), fml::testing::TEST(), TEST(), flutter::testing::TEST(), flutter_runner_test::TEST_F(), flutter::testing::TEST_F(), flutter::VsyncWaiterFallback::VsyncWaiterFallback(), fml::AutoResetWaitableEvent::WaitWithTimeout(), and fml::WaitWithTimeoutImpl().

26  {
27  // The base time is arbitrary; use the clock epoch for convenience.
28  const auto elapsed_time = std::chrono::steady_clock::now().time_since_epoch();
29  return TimePoint(
30  std::chrono::duration_cast<std::chrono::nanoseconds>(elapsed_time)
31  .count());
32 }
constexpr TimePoint()=default

◆ operator!=()

bool fml::TimePoint::operator!= ( TimePoint  other) const
inline

Definition at line 55 of file time_point.h.

55 { return ticks_ != other.ticks_; }

◆ operator+()

TimePoint fml::TimePoint::operator+ ( TimeDelta  duration) const
inline

Definition at line 47 of file time_point.h.

References TimePoint(), and fml::TimeDelta::ToNanoseconds().

47  {
48  return TimePoint(ticks_ + duration.ToNanoseconds());
49  }
constexpr TimePoint()=default

◆ operator-() [1/2]

TimeDelta fml::TimePoint::operator- ( TimePoint  other) const
inline

Definition at line 43 of file time_point.h.

References fml::TimeDelta::FromNanoseconds().

43  {
44  return TimeDelta::FromNanoseconds(ticks_ - other.ticks_);
45  }
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition: time_delta.h:40

◆ operator-() [2/2]

TimePoint fml::TimePoint::operator- ( TimeDelta  duration) const
inline

Definition at line 50 of file time_point.h.

References TimePoint(), and fml::TimeDelta::ToNanoseconds().

50  {
51  return TimePoint(ticks_ - duration.ToNanoseconds());
52  }
constexpr TimePoint()=default

◆ operator<()

bool fml::TimePoint::operator< ( TimePoint  other) const
inline

Definition at line 56 of file time_point.h.

56 { return ticks_ < other.ticks_; }

◆ operator<=()

bool fml::TimePoint::operator<= ( TimePoint  other) const
inline

Definition at line 57 of file time_point.h.

57 { return ticks_ <= other.ticks_; }

◆ operator==()

bool fml::TimePoint::operator== ( TimePoint  other) const
inline

Definition at line 54 of file time_point.h.

54 { return ticks_ == other.ticks_; }

◆ operator>()

bool fml::TimePoint::operator> ( TimePoint  other) const
inline

Definition at line 58 of file time_point.h.

58 { return ticks_ > other.ticks_; }

◆ operator>=()

bool fml::TimePoint::operator>= ( TimePoint  other) const
inline

Definition at line 59 of file time_point.h.

References TimePoint().

59 { return ticks_ >= other.ticks_; }

◆ ToEpochDelta()


The documentation for this class was generated from the following files: