Apache Mesos
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
Duration Class Reference

#include <duration.hpp>

Inheritance diagram for Duration:
Days Hours Microseconds Milliseconds Minutes Nanoseconds Seconds Weeks

Public Member Functions

constexpr Duration ()
 
 Duration (const timeval &t)
 
int64_t ns () const
 
double us () const
 
double ms () const
 
double secs () const
 
double mins () const
 
double hrs () const
 
double days () const
 
double weeks () const
 
struct timeval timeval () const
 
bool operator< (const Duration &d) const
 
bool operator<= (const Duration &d) const
 
bool operator> (const Duration &d) const
 
bool operator>= (const Duration &d) const
 
bool operator== (const Duration &d) const
 
bool operator!= (const Duration &d) const
 
Durationoperator+= (const Duration &that)
 
Durationoperator-= (const Duration &that)
 
template<typename T >
Durationoperator*= (T multiplier)
 
template<typename T >
Durationoperator/= (T divisor)
 
Duration operator+ (const Duration &that) const
 
Duration operator- (const Duration &that) const
 
template<typename T >
Duration operator* (T multiplier) const
 
template<typename T >
Duration operator/ (T divisor) const
 

Static Public Member Functions

static Try< Durationparse (const std::string &s)
 
static Try< Durationcreate (double seconds)
 
static constexpr Duration max ()
 
static constexpr Duration min ()
 
static constexpr Duration zero ()
 

Protected Member Functions

constexpr Duration (int64_t value, int64_t unit)
 

Static Protected Attributes

static constexpr int64_t NANOSECONDS = 1
 
static constexpr int64_t MICROSECONDS = 1000 * NANOSECONDS
 
static constexpr int64_t MILLISECONDS = 1000 * MICROSECONDS
 
static constexpr int64_t SECONDS = 1000 * MILLISECONDS
 
static constexpr int64_t MINUTES = 60 * SECONDS
 
static constexpr int64_t HOURS = 60 * MINUTES
 
static constexpr int64_t DAYS = 24 * HOURS
 
static constexpr int64_t WEEKS = 7 * DAYS
 

Friends

std::ostream & operator<< (std::ostream &stream, const Duration &duration)
 

Constructor & Destructor Documentation

constexpr Duration::Duration ( )
inline
Duration::Duration ( const timeval t)
inlineexplicit
constexpr Duration::Duration ( int64_t  value,
int64_t  unit 
)
inlineprotected

Member Function Documentation

Try< Duration > Duration::create ( double  seconds)
inlinestatic
double Duration::days ( ) const
inline
double Duration::hrs ( ) const
inline
constexpr Duration Duration::max ( )
inlinestatic
constexpr Duration Duration::min ( )
inlinestatic
double Duration::mins ( ) const
inline
double Duration::ms ( ) const
inline
int64_t Duration::ns ( ) const
inline
bool Duration::operator!= ( const Duration d) const
inline
template<typename T >
Duration Duration::operator* ( multiplier) const
inline
template<typename T >
Duration& Duration::operator*= ( multiplier)
inline
Duration Duration::operator+ ( const Duration that) const
inline
Duration& Duration::operator+= ( const Duration that)
inline
Duration Duration::operator- ( const Duration that) const
inline
Duration& Duration::operator-= ( const Duration that)
inline
template<typename T >
Duration Duration::operator/ ( divisor) const
inline
template<typename T >
Duration& Duration::operator/= ( divisor)
inline
bool Duration::operator< ( const Duration d) const
inline
bool Duration::operator<= ( const Duration d) const
inline
bool Duration::operator== ( const Duration d) const
inline
bool Duration::operator> ( const Duration d) const
inline
bool Duration::operator>= ( const Duration d) const
inline
Try< Duration > Duration::parse ( const std::string &  s)
inlinestatic
double Duration::secs ( ) const
inline
struct timeval Duration::timeval ( ) const
inline
double Duration::us ( ) const
inline
double Duration::weeks ( ) const
inline
static constexpr Duration Duration::zero ( )
inlinestatic

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Duration duration 
)
friend

Member Data Documentation

constexpr int64_t Duration::DAYS = 24 * HOURS
staticprotected
constexpr int64_t Duration::HOURS = 60 * MINUTES
staticprotected
constexpr int64_t Duration::MICROSECONDS = 1000 * NANOSECONDS
staticprotected
constexpr int64_t Duration::MILLISECONDS = 1000 * MICROSECONDS
staticprotected
constexpr int64_t Duration::MINUTES = 60 * SECONDS
staticprotected
constexpr int64_t Duration::NANOSECONDS = 1
staticprotected
constexpr int64_t Duration::SECONDS = 1000 * MILLISECONDS
staticprotected
constexpr int64_t Duration::WEEKS = 7 * DAYS
staticprotected

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