Why: Time#
-
void Why::sleep_milli(unsigned int n)#
Delay execution for n milliseconds. This is not a busy wait - the current thread is unscheduled, and woken up after that period. Using msleep() in interrupt service routines is undefined.
-
void Why::busywait_milli(unsigned int n)#
Delay execution for n milliseconds, by entering a calibrated busy loop.
-
void Why::pause()#
Put the current thread to sleep forever. Using pause() in interrupt service routines is undefined.
-
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()#