Why: TimeSpec#
-
class TimeSpec : public timespec#
A wrapper around POSIX timespec that provides convenient arithmetic operations.
TimeSpec extends the standard timespec structure with type-safe construction and arithmetic operators for time manipulation.
Public Functions
-
inline TimeSpec()#
Default constructor - initializes to zero time.
-
inline explicit TimeSpec(uint64_t sec, uint64_t nsec)#
Construct a TimeSpec from seconds and nanoseconds.
Note
Asserts that nsec < 1 second
- Parameters:
sec – Seconds component (must fit in time_t)
nsec – Nanoseconds component (must be < 1,000,000,000)
- Throws:
std::overflow_error – if sec is too large for time_t
-
inline TimeSpec operator+(const TimeSpec &rhs) const#
Add two TimeSpec values.
Note
Properly handles nanosecond overflow into seconds
-
inline TimeSpec()#