blob: 896307a1b219b4f1226f1e3fdf4f49299c52ca3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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],
}
}
}
|