108#include <string_view>
152 explicit inline constexpr
TimeSpan( std::chrono::system_clock::duration duration ) noexcept;
158 explicit
TimeSpan( std::string_view iso8601String );
198 inline constexpr std::strong_ordering operator<=>( const
TimeSpan& other ) const noexcept;
205 inline constexpr
bool operator==( const
TimeSpan& other ) const noexcept;
229 inline constexpr
TimeSpan operator-() const noexcept;
251 inline
TimeSpan operator*(
double multiplier ) const noexcept;
259 inline
TimeSpan operator/(
double divisor ) const noexcept;
266 inline
double operator/( const
TimeSpan& other ) const noexcept;
286 [[nodiscard]] inline
double days() const noexcept;
293 [[nodiscard]] inline
double hours() const noexcept;
300 [[nodiscard]] inline
double minutes() const noexcept;
307 [[nodiscard]] inline
double seconds() const noexcept;
335 [[nodiscard]] inline constexpr std::int64_t
ticks() const noexcept;
367 [[nodiscard]] static
bool fromString( std::string_view iso8601DurationString,
TimeSpan& result ) noexcept;
375 [[nodiscard]] static std::optional<
TimeSpan>
fromString( std::string_view iso8601DurationString ) noexcept;
389 [[nodiscard]] std::chrono::system_clock::duration
toChrono() const noexcept;
400 [[nodiscard]] static
TimeSpan fromChrono( const std::chrono::system_clock::duration& duration ) noexcept;
464 std::int64_t m_ticks;
468#include "nfx/detail/datetime/TimeSpan.inl"
double minutes() const noexcept
Get total minutes.
static constexpr TimeSpan fromSeconds(double seconds) noexcept
Create a TimeSpan from a number of seconds.
static constexpr TimeSpan fromHours(double hours) noexcept
Create a TimeSpan from a number of hours.
constexpr std::int64_t ticks() const noexcept
Get tick count.
static bool fromString(std::string_view iso8601DurationString, TimeSpan &result) noexcept
Parse a TimeSpan from a string safely without throwing exceptions.
double seconds() const noexcept
Get total seconds.
constexpr TimeSpan(std::int64_t ticks=0) noexcept
Construct from ticks (100-nanosecond units).
double hours() const noexcept
Get total hours.
double days() const noexcept
Get total days.
std::chrono::system_clock::duration toChrono() const noexcept
Convert to std::chrono::system_clock::duration.
double microseconds() const noexcept
Get total microseconds.
static TimeSpan fromChrono(const std::chrono::system_clock::duration &duration) noexcept
Create TimeSpan from std::chrono::system_clock::duration.
static constexpr TimeSpan fromDays(double days) noexcept
Create a TimeSpan from a number of days.
double milliseconds() const noexcept
Get total milliseconds.
std::string toString() const
Convert to ISO 8601 duration string.
static constexpr TimeSpan fromMilliseconds(double milliseconds) noexcept
Create a TimeSpan from a number of milliseconds.
double nanoseconds() const noexcept
Get total nanoseconds.
static constexpr TimeSpan fromMinutes(double minutes) noexcept
Create a TimeSpan from a number of minutes.
static constexpr TimeSpan fromMicroseconds(double microseconds) noexcept
Create a TimeSpan from a number of microseconds.
static constexpr TimeSpan fromTicks(double ticks) noexcept
Create a TimeSpan from a number of ticks (100-nanosecond units).