#ifndef TIME_HPP
#define TIME_HPP

#include <chrono>

namespace OpenEngine {
    class Time
    {
        public:
            Time(const Time&) = delete;            // No copy constructor
            Time& operator=(const Time&) = delete;

            void Update();

            static Time& Get()
            {
                if (instance == nullptr)
                    instance.reset(new Time);

                return *instance;
            }

            double DeltaTime() const { return delta_time.count(); };

        private:
            Time() {};
            std::chrono::high_resolution_clock::time_point previous_frame;
            static std::unique_ptr<Time> instance;
            std::chrono::duration<double> delta_time;
    };

}

#endif // TIME_HPP
