viewpoint_core/page/clock/
time_value.rs1#[derive(Debug, Clone)]
5pub enum TimeValue {
6 Timestamp(i64),
8 IsoString(String),
10}
11
12impl From<i64> for TimeValue {
13 fn from(ts: i64) -> Self {
14 TimeValue::Timestamp(ts)
15 }
16}
17
18impl From<u64> for TimeValue {
19 fn from(ts: u64) -> Self {
20 TimeValue::Timestamp(ts as i64)
21 }
22}
23
24impl From<&str> for TimeValue {
25 fn from(s: &str) -> Self {
26 TimeValue::IsoString(s.to_string())
27 }
28}
29
30impl From<String> for TimeValue {
31 fn from(s: String) -> Self {
32 TimeValue::IsoString(s)
33 }
34}