aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO7
-rw-r--r--clock/src/lib.rs7
-rw-r--r--testconfig6
3 files changed, 14 insertions, 6 deletions
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..62b91b1
--- /dev/null
+++ b/TODO
@@ -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
}
diff --git a/testconfig b/testconfig
index 79d92c5..a1de210 100644
--- a/testconfig
+++ b/testconfig
@@ -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