blob: 6e3ec3f53dff43b1c42e65f67c4bad1d507d9b29 (
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
|
/* Starshatter: The Open Source Project
Copyright (c) 2021-2022, 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>
Clock::Clock() :
m_point {inner_clock::now()},
m_compression {1.0}
{
}
double
Clock::Step()
{
const auto next = inner_clock::now();
const std::chrono::duration<double> delta = next - m_point;
m_point = next;
return delta.count() * m_compression;
}
|