28 m_hh(std::min(23,std::max(0,hh))) ,
29 m_mm(std::min(59,std::max(0,mm))) ,
30 m_ss(std::min((hh==23&&mm==59)?60:59,std::max(0,ss)))
78 if( sep ==
nullptr ) sep =
"" ;
79 std::ostringstream ss ;
80 ss << (m_hh/10) << (m_hh%10) << sep << (m_mm/10) << (m_mm%10) << sep << (m_ss/10) << (m_ss%10) ;
86 if( sep ==
nullptr ) sep =
"" ;
87 std::ostringstream ss ;
88 ss << (m_hh/10) << (m_hh%10) << sep << (m_mm/10) << (m_mm%10) ;
94 std::ostringstream ss ;
95 ss << (m_ss/10) << (m_ss%10) ;
102 static_cast<unsigned int>(std::max(0,std::min(23,m_hh))) * 3600U +
103 static_cast<unsigned int>(std::max(0,std::min(59,m_mm))) * 60U +
104 static_cast<unsigned int>(std::max(0,std::min(59,m_ss))) ;
109 unsigned int hh = s / 3600U ;
110 unsigned int mm_ss = s - (hh*3600U) ;
112 std::max(0,std::min(23,
static_cast<int>(hh))) ,
113 std::max(0,std::min(59,
static_cast<int>(mm_ss/60U))) ,
114 std::max(0,std::min(59,
static_cast<int>(mm_ss%60U))) } ;
119 return m_hh == other.m_hh && m_mm == other.m_mm && m_ss == other.m_ss ;
124 return !(*
this==other) ;
An encapsulation of 'struct std::tm'.
Represents a unix-epoch time with microsecond resolution.
An overload discriminator class for Time constructors.
A simple time-of-day (hh/mm/ss) class.
bool operator==(const Time &) const
Comparison operator.
unsigned int value() const
Returns the time as the number of seconds since midnight (ignoring leap seconds).
int minutes() const
Returns the minutes (0 <= m < 60).
static Time at(unsigned int)
Factory function for a time that is the given number of seconds since midnight (see value()).
std::string hhmm(const char *sep=nullptr) const
Returns the hhmm string.
int hours() const
Returns the hours (0 <= h < 24).
Time()
Constructor for the current time, using UTC.
std::string ss() const
Returns the seconds as a two-digit decimal string.
int seconds() const
Returns the seconds (0 <= s <= 61).
bool operator!=(const Time &) const
Comparison operator.
std::string hhmmss(const char *sep=nullptr) const
Returns the hhmmss string.