ravel
Deterministic simulation testing for C++. Seed a bug, replay it exact.
Loading...
Searching...
No Matches
clock.hpp
1#pragma once
2
3#include <cstdint>
4
5namespace ravel {
6
7class Scheduler;
8
13 public:
15 using Tick = std::uint64_t;
16
18 Tick now() const noexcept { return now_; }
19
20 private:
21 friend class Scheduler;
22
23 void advance_to(Tick time) noexcept { now_ = time; }
24
25 Tick now_ = 0;
26};
27
28} // namespace ravel
Cooperative, single-threaded task scheduler.
Definition scheduler.hpp:65
Monotonic virtual time.
Definition clock.hpp:12
Tick now() const noexcept
The current virtual time.
Definition clock.hpp:18
std::uint64_t Tick
Virtual time, in ticks. A tick has no fixed real-world length.
Definition clock.hpp:15