summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Clock.inl.h
blob: 7a2a765a4edabc2bfab3adb3f8a845373a3c554e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.
*/

#include "Clock.h"

#include <chrono>
#include <ratio>


template <typename R>
R
Clock::GameTime() const
{
    using target_duration = std::chrono::duration<R, std::milli>;
    return std::chrono::duration_cast<target_duration>(m_game_elapsed).count();
}


template <typename R>
R
Clock::RealTime() const
{
    using target_duration = std::chrono::duration<R, std::milli>;
    return std::chrono::duration_cast<target_duration>(m_real_elapsed).count();
}