Hyper API for C++  0.0.16638
Hyper client library for C++ applications
hyperapi::Time Class Referencefinal

A time data value. More...

#include <Time.hpp>

Public Member Functions

 Time () noexcept
 Default constructor.
 
 Time (int8_t hour, std::int8_t minute, std::int8_t second, std::int32_t microsecond=0) noexcept
 Creates a time value from separate time components. More...
 
std::int8_t getHour () const noexcept
 Gets the hour. More...
 
std::int8_t getMinute () const noexcept
 Gets the minute. More...
 
std::int8_t getSecond () const noexcept
 Gets the second. More...
 
std::int32_t getMicrosecond () const noexcept
 Gets the microsecond. More...
 
std::string toString () const
 Gets a string representation for debugging. More...
 
hyper_time_t getRaw () const noexcept
 Gets the raw time value encoded as microseconds since midnight. More...
 

Friends

bool operator== (const Time &lhs, const Time &rhs) noexcept
 Equality operator.
 
bool operator> (const Time &lhs, const Time &rhs) noexcept
 Greater operator.
 
bool operator!= (const Time &a, const Time &b) noexcept
 Not equal operator.
 
bool operator< (const Time &a, const Time &b) noexcept
 Less than operator.
 
bool operator<= (const Time &a, const Time &b) noexcept
 Less than or equal operator.
 
bool operator>= (const Time &a, const Time &b) noexcept
 Greater or equal operator.
 
std::ostream & operator<< (std::ostream &os, const Time &obj)
 Stream output operator.
 

Detailed Description

A time data value.

Definition at line 18 of file Time.hpp.

Constructor & Destructor Documentation

◆ Time()

hyperapi::Time::Time ( int8_t  hour,
std::int8_t  minute,
std::int8_t  second,
std::int32_t  microsecond = 0 
)
noexcept

Creates a time value from separate time components.

Parameters
hourThe hour.
minuteThe minute.
secondThe second.
microsecondThe microsecond.
Precondition
hour must be between 0 and 23, minute and second between 0 and 59, and microsecond smaller than 1'000'000.

Member Function Documentation

◆ getHour()

std::int8_t hyperapi::Time::getHour ( ) const
noexcept

Gets the hour.

Returns
The hour.

◆ getMicrosecond()

std::int32_t hyperapi::Time::getMicrosecond ( ) const
noexcept

Gets the microsecond.

Returns
The microsecond.

◆ getMinute()

std::int8_t hyperapi::Time::getMinute ( ) const
noexcept

Gets the minute.

Returns
The minute.

◆ getRaw()

hyper_time_t hyperapi::Time::getRaw ( ) const
noexcept

Gets the raw time value encoded as microseconds since midnight.

Returns
The raw time value.

◆ getSecond()

std::int8_t hyperapi::Time::getSecond ( ) const
noexcept

Gets the second.

Returns
The second.

◆ toString()

std::string hyperapi::Time::toString ( ) const

Gets a string representation for debugging.

Returns
the time in the 'HH:MM:SS.ssssss' format

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