diff options
| author | Andreas Grois <andi@grois.info> | 2021-04-22 20:44:06 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-04-22 20:44:06 +0200 |
| commit | 7e190c3aafd7b7c14af126368f8c35ef150bbf54 (patch) | |
| tree | 0e0b326903961c030247eb3045b3b4d5e8f4a923 | |
| parent | d380bfdba3a01eeb5647600b1939bbd68741e768 (diff) | |
Change format for clock refresh rate once more.
It's now optional again, but needs its own block.
| -rw-r--r-- | TODO | 7 | ||||
| -rw-r--r-- | clock/src/lib.rs | 7 | ||||
| -rw-r--r-- | testconfig | 6 |
3 files changed, 14 insertions, 6 deletions
@@ -0,0 +1,7 @@ +o) Factor out lib- and plugin-loading in a way that still gives a vector of libs, but an Iterator over the plugins (so caller can choose if Vec or something else) +o) Add --plugin-help parameter that takes a list of plugins for which to display help (or if none given for all of them). This also means changing the Plugin trait once more. +o) Add --list-plugins parameter that just lists all loaded plugins. + +Clock: +o) Add a corrective sleep of 1 ms if rounding errors are detected at startup or manual update. (current time + 1 ms rounds to a different update-fraction than current time) +o) Change configuration format. Instead of directly entering seconds as a float, update rate should be "how often to update within 30 minutes" as u16. That way the _data type_ already enforces the precision limits :D diff --git a/clock/src/lib.rs b/clock/src/lib.rs index da4ee94..79426ce 100644 --- a/clock/src/lib.rs +++ b/clock/src/lib.rs @@ -77,14 +77,14 @@ impl<'c> SwayStatusModuleRunnable for ClockRunnable<'c> { /// maximum update rate was chosen to be way below 1/ms. By coincidence a 16 bit integer fits the /// range of reasonable values nicely. #[derive(Serialize, Deserialize)] -#[serde(untagged)] +#[serde(tag = "Synchronization")] enum ClockRefreshRate { NotSynchronized { - #[serde(rename = "UnsyncedEverySeconds")] + #[serde(rename = "Seconds")] seconds : f32 }, UTCSynchronized { - #[serde(rename = "UTCSyncedUpdatesPerThirtyMinutes")] + #[serde(rename = "PerThirtyMinutes")] updates_per_thirty_minutes : u16 } } @@ -93,7 +93,6 @@ enum ClockRefreshRate { #[serde(rename_all = "PascalCase",default)] struct ClockConfig { format : String, - #[serde(flatten)] refresh_rate : ClockRefreshRate } @@ -6,11 +6,13 @@ Plugin = "ClockPlugin" [Elements.Config] Format = "%+" -UTCSyncedUpdatesPerThirtyMinutes = 1800 [[Elements]] Plugin = "ClockPlugin" [Elements.Config] Format = "%+" -UnsyncedEverySeconds = 10.0 + +[Elements.Config.RefreshRate] +Synchronization = "UTCSynchronized" +PerThirtyMinutes = 3600 |
