diff options
Diffstat (limited to 'src/timeman.rs')
| -rw-r--r-- | src/timeman.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/timeman.rs b/src/timeman.rs index 9d17999..32a6f45 100644 --- a/src/timeman.rs +++ b/src/timeman.rs @@ -4,14 +4,18 @@ use std::{fmt::Display, string}; use std::error::Error; use crate::GameState; -use crate::window::ui::GameWindowUiState; pub type Second = u64; +pub const MINUTE: Second = 60; +pub const HOUR: Second = MINUTE * 60; +pub const DAY: Second = HOUR * 24; +pub const YEAR: Second = DAY * 365; + pub struct TimeMan { time: Second, - auto_tick: Option<Second> + pub auto_tick: Option<Second> } impl TimeMan @@ -58,11 +62,11 @@ impl TimeMan } format!("{}{}{}{}{}", - if seconds > 0 { format!("{}s", seconds) } else { format!("") }, - if minutes > 0 { format!("{}m", minutes) } else { format!("") }, - if hours > 0 { format!("{}h", hours) } else { format!("") }, + if years > 0 { format!("{}y", years) } else { format!("") }, if days > 0 { format!("{}d", days) } else { format!("") }, - if years > 0 { format!("{}y", years) } else { format!("") }) + if hours > 0 { format!("{}h", hours) } else { format!("") }, + if minutes > 0 { format!("{}m", minutes) } else { format!("") }, + if seconds > 0 { format!("{}s", seconds) } else { format!("") }) } |
