tavern_keeper/src/time.rs

18 lines
349 B
Rust

use std::fmt;
#[derive(Clone, Copy)]
pub struct Time{
pub time: u32,
}
impl fmt::Display for Time {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let year = self.time / 360;
let month = (self.time / 30) % 12;
let day = self.time % 30;
write!(f, "Year {}, {} of {}", year, day, month)
}
}