| 4 | using namespace co_context; |
| 5 | |
| 6 | task<> cycle_abs(int sec) { |
| 7 | auto next = std::chrono::steady_clock::now(); |
| 8 | while (true) { |
| 9 | next = next + std::chrono::seconds{sec}; |
| 10 | co_await timeout_at(next); |
| 11 | auto late = std::chrono::steady_clock::now() - next; |
| 12 | printf("late = %ld ns\n", late.count()); |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | int main() { |
| 17 | io_context ctx; |