toml::time_offset struct

A timezone offset.

Constructors, destructors, conversion operators

time_offset() defaulted noexcept
Default constructor. Does not initialize the members.
template <typename H, typename M>
time_offset(H h, M m) constexpr noexcept
Constructs a timezone offset from individual hour and minute totals.

Public variables

int16_t minutes
Offset from UTC+0, in minutes.

Friends

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

Function documentation

template <typename H, typename M>
toml::time_offset::time_offset(H h, M m) constexpr noexcept

Constructs a timezone offset from individual hour and minute totals.

Template parameters
H An integral type.
M An integral type.
Parameters
h The total hours.
m The total minutes.
std::cout << toml::time_offset{ 2, 30 } << "\n";
std::cout << toml::time_offset{ -2, 30 } << "\n";
std::cout << toml::time_offset{ -2, -30 } << "\n";
std::cout << toml::time_offset{ 0, 0 } << "\n";
+02:30
-01:30
-02:30
Z

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

Prints a time_offset out to a stream as +-HH:MM or Z (per RFC 3339).

std::cout << toml::time_offset{ 2, 30 } << "\n";
std::cout << toml::time_offset{ 2, -30 } << "\n";
std::cout << toml::time_offset{} << "\n";
std::cout << toml::time_offset{ -2, 30 } << "\n";
std::cout << toml::time_offset{ -2, -30 } << "\n";
+02:30
+01:30
Z
-01:30
-02:30