syndicate-nim/tests/solo5_test.nim

26 lines
693 B
Nim
Raw Normal View History

2024-04-03 10:01:17 +00:00
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/times
import solo5
import syndicate, syndicate/drivers/timers
acquireDevices()
2024-04-30 10:52:40 +00:00
runActor("timer-test") do (turn: Turn):
2024-04-03 10:01:17 +00:00
let timers = newDataspace(turn)
spawnTimerDriver(turn, timers)
onPublish(turn, timers, ?LaterThan(seconds: 1356100000)):
echo "now in 13th bʼakʼtun"
2024-04-30 10:52:40 +00:00
after(turn, timers, initDuration(seconds = 3)) do (turn: Turn):
2024-04-03 10:01:17 +00:00
echo "third timer expired"
stopActor(turn)
2024-04-30 10:52:40 +00:00
after(turn, timers, initDuration(seconds = 1)) do (turn: Turn):
2024-04-03 10:01:17 +00:00
echo "first timer expired"
2024-04-30 10:52:40 +00:00
after(turn, timers, initDuration(seconds = 2)) do (turn: Turn):
2024-04-03 10:01:17 +00:00
echo "second timer expired"