bn::time class
#include <bn_time.h>

Defines a clock time, which it can express as the numbers of hours, minutes and seconds since midnight.

Public static functions

static auto valid(int hour, int minute, int second) -> bool constexpr
Indicates if the specified time is valid or not.
static auto active() -> bool
Indicates if the real time clock (RTC) is present or not.
static auto current() -> optional<time>
Returns the current time as reported by the real time clock (RTC) if it's present and the reported time is valid; bn::nullopt otherwise.

Constructors, destructors, conversion operators

time(int hour, int minute, int second) constexpr
Constructor.

Public functions

auto hour() const -> int constexpr
Returns the hour part of the time.
void set_hour(int hour) constexpr
Sets the hour part of the time.
auto minute() const -> int constexpr
Returns the minute part of the time.
void set_minute(int minute) constexpr
Sets the minute part of the time.
auto second() const -> int constexpr
Returns the second part of the time.
void set_second(int second) constexpr
Sets the second part of the time.

Friends

auto operator==(time a, time b) -> bool defaulted constexpr
Default equal operator.
auto operator<(time a, time b) -> bool constexpr
Less than operator.
auto operator>(time a, time b) -> bool constexpr
Greater than operator.
auto operator<=(time a, time b) -> bool constexpr
Less than or equal operator.
auto operator>=(time a, time b) -> bool constexpr
Greater than or equal operator.

Function documentation

static bool bn::time::valid(int hour, int minute, int second) constexpr

Indicates if the specified time is valid or not.

Parameters
hour Hour part of the time, in the range [0..23].
minute Minute part of the time, in the range [0..59].
second Second part of the time, in the range [0..59].
Returns true if the specified time is valid; false otherwise.

bn::time::time(int hour, int minute, int second) constexpr

Constructor.

Parameters
hour Hour part of the time, in the range [0..23].
minute Minute part of the time, in the range [0..59].
second Second part of the time, in the range [0..59].

void bn::time::set_hour(int hour) constexpr

Sets the hour part of the time.

Parameters
hour Hour part of the time, in the range [0..23].

void bn::time::set_minute(int minute) constexpr

Sets the minute part of the time.

Parameters
minute Minute part of the time, in the range [0..23].

void bn::time::set_second(int second) constexpr

Sets the second part of the time.

Parameters
second Second part of the time, in the range [0..23].

bool operator<(time a, time b) constexpr

Less than operator.

Parameters
a First time to compare.
b Second time to compare.
Returns true if the first time is earlier than the second one, otherwise false.

bool operator>(time a, time b) constexpr

Greater than operator.

Parameters
a First time to compare.
b Second time to compare.
Returns true if the first time is later than the second one, otherwise false.

bool operator<=(time a, time b) constexpr

Less than or equal operator.

Parameters
a First time to compare.
b Second time to compare.
Returns true if the first time is earlier than or equal to the second one, otherwise false.

bool operator>=(time a, time b) constexpr

Greater than or equal operator.

Parameters
a First time to compare.
b Second time to compare.
Returns true if the first time is later than or equal to the second one, otherwise false.