<?php

    namespace Icing\Utility;

    use DebugKit\DebugTimer;

    class Timer extends DebugTimer
    {

        public static function get($name = 'default', $precision = 5): float|int
        {
            return self::elapsedTime($name, $precision);
        }

        public static function elapsedTime($name = 'default', $precision = 5): float
        {
            if (isset(self::$_timers[$name]['start']) || !isset(self::$_timers[$name]['end'])) {
                return round(microtime(true) - self::$_timers[$name]['start'], $precision);
            }

            return parent::elapsedTime($name, $precision);
        }


    }
