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

Cyber has builtin time type Time. More...

#include <time.h>

Collaboration diagram for apollo::cyber::Time:
Collaboration graph

Public Member Functions

 Time ()=default
 
 Time (uint64_t nanoseconds)
 
 Time (int nanoseconds)
 
 Time (double seconds)
 
 Time (uint32_t seconds, uint32_t nanoseconds)
 
 Time (const Time &other)
 
Timeoperator= (const Time &other)
 
double ToSecond () const
 convert time to second. More...
 
uint64_t ToMicrosecond () const
 convert time to microsecond (us). More...
 
uint64_t ToNanosecond () const
 convert time to nanosecond. More...
 
std::string ToString () const
 convert time to a string. More...
 
bool IsZero () const
 determine if time is 0 More...
 
Duration operator- (const Time &rhs) const
 
Time operator+ (const Duration &rhs) const
 
Time operator- (const Duration &rhs) const
 
Timeoperator+= (const Duration &rhs)
 
Timeoperator-= (const Duration &rhs)
 
bool operator== (const Time &rhs) const
 
bool operator!= (const Time &rhs) const
 
bool operator> (const Time &rhs) const
 
bool operator< (const Time &rhs) const
 
bool operator>= (const Time &rhs) const
 
bool operator<= (const Time &rhs) const
 

Static Public Member Functions

static Time Now ()
 get the current time. More...
 
static Time MonoTime ()
 
static void SleepUntil (const Time &time)
 Sleep Until time. More...
 

Static Public Attributes

static const Time MAX
 
static const Time MIN
 

Detailed Description

Cyber has builtin time type Time.

Constructor & Destructor Documentation

◆ Time() [1/6]

apollo::cyber::Time::Time ( )
default

◆ Time() [2/6]

apollo::cyber::Time::Time ( uint64_t  nanoseconds)
explicit

◆ Time() [3/6]

apollo::cyber::Time::Time ( int  nanoseconds)
explicit

◆ Time() [4/6]

apollo::cyber::Time::Time ( double  seconds)
explicit

◆ Time() [5/6]

apollo::cyber::Time::Time ( uint32_t  seconds,
uint32_t  nanoseconds 
)

◆ Time() [6/6]

apollo::cyber::Time::Time ( const Time other)

Member Function Documentation

◆ IsZero()

bool apollo::cyber::Time::IsZero ( ) const

determine if time is 0

Returns
return true if time is 0

◆ MonoTime()

static Time apollo::cyber::Time::MonoTime ( )
static

◆ Now()

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

get the current time.

Returns
return the current time.

◆ operator!=()

bool apollo::cyber::Time::operator!= ( const Time rhs) const

◆ operator+()

Time apollo::cyber::Time::operator+ ( const Duration rhs) const

◆ operator+=()

Time& apollo::cyber::Time::operator+= ( const Duration rhs)

◆ operator-() [1/2]

Duration apollo::cyber::Time::operator- ( const Time rhs) const

◆ operator-() [2/2]

Time apollo::cyber::Time::operator- ( const Duration rhs) const

◆ operator-=()

Time& apollo::cyber::Time::operator-= ( const Duration rhs)

◆ operator<()

bool apollo::cyber::Time::operator< ( const Time rhs) const

◆ operator<=()

bool apollo::cyber::Time::operator<= ( const Time rhs) const

◆ operator=()

Time& apollo::cyber::Time::operator= ( const Time other)

◆ operator==()

bool apollo::cyber::Time::operator== ( const Time rhs) const

◆ operator>()

bool apollo::cyber::Time::operator> ( const Time rhs) const

◆ operator>=()

bool apollo::cyber::Time::operator>= ( const Time rhs) const

◆ SleepUntil()

static void apollo::cyber::Time::SleepUntil ( const Time time)
static

Sleep Until time.

Parameters
timethe Time object.

◆ ToMicrosecond()

uint64_t apollo::cyber::Time::ToMicrosecond ( ) const

convert time to microsecond (us).

Returns
return a unit64_t value unit is us.

◆ ToNanosecond()

uint64_t apollo::cyber::Time::ToNanosecond ( ) const

convert time to nanosecond.

Returns
return a unit64_t value unit is nanosecond.

◆ ToSecond()

double apollo::cyber::Time::ToSecond ( ) const

convert time to second.

Returns
return a double value unit is second.

◆ ToString()

std::string apollo::cyber::Time::ToString ( ) const

convert time to a string.

Returns
return a string.

Member Data Documentation

◆ MAX

const Time apollo::cyber::Time::MAX
static

◆ MIN

const Time apollo::cyber::Time::MIN
static

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