diff options
Diffstat (limited to 'Stars45/Clock.cpp')
-rw-r--r-- | Stars45/Clock.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Stars45/Clock.cpp b/Stars45/Clock.cpp index 03c2771..e5db6c3 100644 --- a/Stars45/Clock.cpp +++ b/Stars45/Clock.cpp @@ -11,6 +11,36 @@ static constexpr double NO_COMPRESSION {1.0}; static constexpr double STARTING_DELTA {1.0 / 60.0}; +Clock* Clock::instance = nullptr; + + +Clock* +Clock::GetInstance() +{ + return instance; +} + + +bool +Clock::Init() +{ + if (instance == nullptr) { + instance = new Clock(); + return instance != nullptr; + } + return false; +} + + +void +Clock::Close() +{ + if (instance != nullptr) { + delete instance; + instance = nullptr; + } +} + Clock::Clock() : m_point {inner_clock::now()}, |