Time: Set minimum wait for subscription to 1ms

The Clock was freezing with
```
ERRO thread 'main' panicked at '`period` must be non-zero.', /home/system76/ca/cosmic-applets/applets/cosmic-applet-time/vendor/iced_futures/src/backend/native/tokio.rs:62:21
```
This commit is contained in:
13r0ck 2022-12-22 11:10:47 -07:00 committed by Ashley Wulber
parent 31362c7dc1
commit 11eb4cefc2

View file

@ -100,7 +100,7 @@ impl Application for Time {
.expect("Setting seconds to 0 should always be possible")
.with_nanosecond(0)
.expect("Setting nanoseconds to 0 should always be possible.");
let wait = (next - now).num_milliseconds();
let wait = 1.max((next - now).num_milliseconds());
time::every(Duration::from_millis(
wait.try_into().unwrap_or(FALLBACK_DELAY),
))