aboutsummaryrefslogtreecommitdiff
path: root/src/clock.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/clock.rs')
-rw-r--r--src/clock.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/clock.rs b/src/clock.rs
new file mode 100644
index 0000000..896307a
--- /dev/null
+++ b/src/clock.rs
@@ -0,0 +1,22 @@
+use std::time::Duration;
+
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct Clock {
+ pub time: [Duration; 2], // White, Black
+ pub increment: [Duration; 2],
+}
+
+impl Default for Clock {
+ fn default() -> Self {
+ Self::new(Duration::from_secs(60 * 5), Duration::from_secs(3))
+ }
+}
+
+impl Clock {
+ pub fn new(time: Duration, increment: Duration) -> Self {
+ Self {
+ time: [time, time],
+ increment: [increment, increment],
+ }
+ }
+}