CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
wall_clock_source.hh
1#pragma once
2
3#include <concepts>
4#include <time.h>
5#include <timeout.h>
6
7/**
8 * Concept for wall-clock time sources (and sinks, if they support persisting
9 * time).
10 */
11template<typename T>
13 requires(T v, TimeoutArgument t, clock_t c, int i) {
14 /// Clock sources must expose whether they support setting the time.
15 { T::SupportsTimeSetting } -> std::same_as<const bool &>;
16 /**
17 * Clock sources must expose whether they are cheap enough to call
18 * every time a user asks for the clock to be updated or only after
19 * there is some reasonable possibility of clock drift.
20 */
21 { T::IsCheap } -> std::same_as<const bool &>;
22
23 /**
24 * Clock sources must provide a mechanism to get a matching pair of
25 * monotonic and wall-clock time and a priority. This returns 0 on
26 * success.
27 */
28 { v.get_time(t, c, c, i) } -> std::same_as<int>;
29 } &&
30 ((T::SupportsTimeSetting == true) &&
31 requires(T v) {
32 {
33 v.set_time(std::declval<TimeoutArgument>, std::declval<clock_t &>)
34 } -> std::same_as<int>;
35 } ||
36 requires { !T::SupportsTimeSetting; });
Concept for wall-clock time sources (and sinks, if they support persisting time).
uint64_t clock_t
Type for holding time.
Definition time.h:68
This file contains the types used for timeouts across scheduler APIs.