Struct time_offset

Synopsis

#include <toml/datetime.hpp>

struct time_offset

Description

No description yet.

Methods

time_offset overload
~time_offset
operator std::chrono::minutes
operator= overload

Source

Lines 298-320 in toml/datetime.hpp.

struct time_offset
{
    std::int8_t hour;   // [-12, 12]
    std::int8_t minute; // [-59, 59]

    time_offset(int h, int m)
        : hour  (static_cast<std::int8_t>(h)),
          minute(static_cast<std::int8_t>(m))
    {}

    operator std::chrono::minutes() const
    {
        return std::chrono::minutes(this->minute) +
               std::chrono::hours(this->hour);
    }

    time_offset() = default;
    ~time_offset() = default;
    time_offset(time_offset const&) = default;
    time_offset(time_offset&&)      = default;
    time_offset& operator=(time_offset const&) = default;
    time_offset& operator=(time_offset&&)      = default;
};





Add Discussion as Guest

Log in