#include #include int main() { Void::Time::ManualClock mono{}; auto sched = Void::Scheduler::Scheduler::create( Void::Scheduler::SchedulerOptions{.monotonic_clock = &mono}); if (!sched.has_value()) { return EXIT_FAILURE; } int ran = 0; if (!sched->register_handler( "ping", [&](const Void::Scheduler::OccurrenceContext&, std::span, Void::Async::OperationOptions) -> Void::Scheduler::Result { ++ran; return {}; }) .has_value()) { return EXIT_FAILURE; } Void::Scheduler::JobSpec spec{}; spec.id = "j1"; spec.handler_id = "ping"; spec.schedule = Void::Scheduler::Schedule::one_shot_monotonic(mono.now()); if (!sched->add_job(spec).has_value()) { return EXIT_FAILURE; } auto count = sched->tick(); if (!count.has_value() || *count != 1U || ran != 1) { return EXIT_FAILURE; } if (!sched->close_and_join().has_value()) { return EXIT_FAILURE; } return EXIT_SUCCESS; }