3#include <ossia/detail/config.hpp>
17using clock_type = std::chrono::steady_clock;
18class OSSIA_EXPORT clock
20 friend class time_interval;
28 using exec_status_callback = std::function<void(exec_status)>;
37 void start_and_tick();
46 [[nodiscard]]
bool paused()
const;
59 [[nodiscard]] time_value get_duration()
const;
68 [[nodiscard]] time_value get_granularity()
const;
73 clock& set_granularity(std::chrono::microseconds);
74 clock& set_granularity(std::chrono::milliseconds);
78 [[nodiscard]]
bool running()
const;
82 [[nodiscard]] time_value get_position()
const;
86 [[nodiscard]] time_value get_date()
const;
89 void set_exec_status_callback(exec_status_callback);
90 [[nodiscard]] exec_status_callback get_exec_status_callback()
const;
100 time_interval& m_interval;
104 time_value m_duration{};
107 time_value m_granularity{};
113 std::thread m_thread;
116 clock_type::time_point m_lastTime{};
118 exec_status_callback m_statusCallback;
121 int64_t m_elapsedTime{};
123 std::atomic_bool m_running{};
124 std::atomic_bool m_paused{};
125 std::atomic_bool m_shouldStop{};
128 void thread_callback();
The time_interval class.
Definition time_interval.hpp:49
The time_value class.
Definition ossia/editor/scenario/time_value.hpp:30