werkzeugkiste::config::time struct
#include <types.h>

Represents a local time.

Constructors, destructors, conversion operators

time() defaulted
time(std::string_view str) explicit
Parses a string representation.
time(uint32_t h, uint32_t m, uint32_t s = 0, uint32_t ns = 0)

Public functions

auto ToString() const -> std::string
Returns "HH:MM:SS.sssssssss".
auto IsValid() const -> bool
Returns true if this is a valid time between 00:00 and 23:59:59.999999999.
auto operator==(const time& other) const -> bool
auto operator!=(const time& other) const -> bool
auto operator<(const time& other) const -> bool
auto operator<=(const time& other) const -> bool
auto operator>(const time& other) const -> bool
auto operator>=(const time& other) const -> bool

Public variables

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

Friends

auto operator<<(std::ostream& os, const time& t) -> std::ostream&
Overloaded stream operator.

Function documentation

werkzeugkiste::config::time::time(std::string_view str) explicit

Parses a string representation.

Supported formats are:

  • HH:MM
  • HH:MM:SS
  • HH:MM:SS.sss (for milliseconds)
  • HH:MM:SS.ssssss (for microseconds)
  • HH:MM:SS.sssssssss (for nanoseconds)