alarm.time
– Trigger an alarm when the specified time is reached.
- class alarm.time.TimeAlarm(*, monotonic_time: float | None = None, epoch_time: int | None = None)
Create an alarm that will be triggered when
time.monotonic()
would equalmonotonic_time
, or whentime.time()
would equalepoch_time
. Only one of the two arguments can be given. The alarm is not active until it is passed to analarm
-enabling sleep function, such asalarm.light_sleep_until_alarms()
oralarm.exit_and_deep_sleep_until_alarms()
.If the given time is already in the past, then an exception is raised. If the sleep happens after the given time, then it will wake immediately due to this time alarm.
- monotonic_time: float
When this time is reached, the alarm will trigger, based on the
time.monotonic()
clock. The time may be given asepoch_time
in the constructor, but it is returned by this property only as atime.monotonic()
time.