MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::detail Namespace Reference

Classes

class  LimitedJsonParseContext

Functions

constexpr clockid_t clockToId (Clock clock) noexcept
constexpr Duration getClockOffset (Clock clock) noexcept

Function Documentation

◆ clockToId()

clockid_t mxl::lib::detail::clockToId ( Clock clock)
constexprnoexcept

Definition at line 11 of file ClockHelpers.hpp.

12 {
13 switch (clock)
14 {
16#if defined(CLOCK_MONOTONIC_RAW)
17 return CLOCK_MONOTONIC_RAW;
18#else
19 return CLOCK_MONOTONIC;
20#endif
21
22#if defined(CLOCK_TAI)
23 case Clock::TAI: return CLOCK_TAI;
24#endif
25 case Clock::ProcessCPUTime: return CLOCK_PROCESS_CPUTIME_ID;
26
27 case Clock::ThreadCPUTime: return CLOCK_THREAD_CPUTIME_ID;
28
29 default: return CLOCK_REALTIME;
30 }
31 }

◆ getClockOffset()

Duration mxl::lib::detail::getClockOffset ( Clock clock)
constexprnoexcept

Definition at line 33 of file ClockHelpers.hpp.

34 {
35 [[maybe_unused]]
36 constexpr auto const ZERO_SECONDS = fromSeconds(0.0);
37 [[maybe_unused]]
38 constexpr auto const TAI_LEAP_SECONDS = fromSeconds(37.0);
39
40 switch (clock)
41 {
42#if !defined(CLOCK_TAI)
43 case Clock::TAI: return TAI_LEAP_SECONDS;
44#endif
45 default: return ZERO_SECONDS;
46 }
47 }
constexpr Duration fromSeconds(double duration) noexcept
Definition Timing.hpp:370