use std::sync::OnceLock;
use std::time::Instant;

static GAME_START: OnceLock<Instant> = OnceLock::new();

pub struct Time;

impl Time
{
    pub fn init()
    {
        GAME_START.get_or_init(Instant::now);
    }

    pub fn get_time_elapsed() -> f32
    {
        GAME_START
            .get()
            .map(|start| start.elapsed().as_secs_f32())
            .unwrap_or(0.0)
    }
}
