Apollo  6.0
Open source self driving car software
Static Public Member Functions | Static Public Attributes | List of all members
apollo::cyber::Clock Class Reference

a singleton clock that can be used to get the current timestamp. The source can be either system(cyber) clock or a mock clock. Mock clock is for testing purpose mainly. More...

#include <clock.h>

Collaboration diagram for apollo::cyber::Clock:
Collaboration graph

Static Public Member Functions

static Time Now ()
 PRECISION >= 1000000 means the precision is at least 1us. More...
 
static double NowInSeconds ()
 gets the current time in second. More...
 
static void SetNow (const Time &now)
 This is for mock clock mode only. It will set the timestamp for the mock clock. More...
 
static void SetMode (ClockMode mode)
 
static ClockMode mode ()
 Gets the current clock mode. More...
 
static void SetNowInSeconds (const double seconds)
 This is for mock clock mode only. It will set the timestamp for the mock clock with UNIX timestamp in seconds. More...
 

Static Public Attributes

static constexpr int64_t PRECISION
 

Detailed Description

a singleton clock that can be used to get the current timestamp. The source can be either system(cyber) clock or a mock clock. Mock clock is for testing purpose mainly.

Member Function Documentation

◆ mode()

static ClockMode apollo::cyber::Clock::mode ( )
static

Gets the current clock mode.

Returns
The current clock mode.

◆ Now()

static Time apollo::cyber::Clock::Now ( )
static

PRECISION >= 1000000 means the precision is at least 1us.

get current time.

Returns
a Time object representing the current time.

◆ NowInSeconds()

static double apollo::cyber::Clock::NowInSeconds ( )
static

gets the current time in second.

Returns
the current time in second.

◆ SetMode()

static void apollo::cyber::Clock::SetMode ( ClockMode  mode)
static

◆ SetNow()

static void apollo::cyber::Clock::SetNow ( const Time now)
static

This is for mock clock mode only. It will set the timestamp for the mock clock.

◆ SetNowInSeconds()

static void apollo::cyber::Clock::SetNowInSeconds ( const double  seconds)
inlinestatic

This is for mock clock mode only. It will set the timestamp for the mock clock with UNIX timestamp in seconds.

Member Data Documentation

◆ PRECISION

constexpr int64_t apollo::cyber::Clock::PRECISION
static
Initial value:
=
std::chrono::system_clock::duration::period::den /
std::chrono::system_clock::duration::period::num

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