toml::time struct

A local time-of-day.

Constructors, destructors, conversion operators

time() defaulted noexcept
Default constructor. Does not initialize the members.
template <typename H, typename M, typename S = uint8_t, typename NS = uint32_t>
time(H h, M m, S s = S{}, NS ns = NS{}) constexpr noexcept
Constructs a time from individual time component values.

Public variables

uint8_t hour
The hour component, from 0 - 23.
uint8_t minute
The minute component, from 0 - 59.
uint8_t second
The second component, from 0 - 59.
uint32_t nanosecond
The fractional nanoseconds component, from 0 - 999999999.

Friends

auto operator!=(const time& lhs, const time& rhs) →  bool constexpr noexcept
Inequality operator.
auto operator<(const time& lhs, const time& rhs) →  bool constexpr noexcept
Less-than operator.
auto operator<<(std::ostream& lhs, const time& rhs) →  std::ostream&
Prints a time out to a stream as HH:MM:SS.FFFFFF (per RFC 3339).
auto operator<=(const time& lhs, const time& rhs) →  bool constexpr noexcept
Less-than-or-equal-to operator.
auto operator==(const time& lhs, const time& rhs) →  bool constexpr noexcept
Equality operator.
auto operator>(const time& lhs, const time& rhs) →  bool constexpr noexcept
Greater-than operator.
auto operator>=(const time& lhs, const time& rhs) →  bool constexpr noexcept
Greater-than-or-equal-to operator.

Function documentation

std::ostream& operator<<(std::ostream& lhs, const time& rhs)

Prints a time out to a stream as HH:MM:SS.FFFFFF (per RFC 3339).

std::cout << toml::time{ 10, 20, 34 } << "\n";
std::cout << toml::time{ 10, 20, 34, 500000000 } << "\n";
10:20:34
10:20:34.5