AppleWin/source/frontends/common2/speed.h
Andrea Odetti 3b917e93be common2: add namespace and reformat everything with space over tabs.
This makes it "possible" to use other editors (than emacs).

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2021-02-25 16:04:50 +00:00

26 lines
476 B
C++

#pragma once
#include <chrono>
namespace common2
{
class Speed
{
public:
Speed(const bool fixedSpeed);
void reset();
// calculate the number of cycles to execute in the current period
// assuming the next call will happen in x microseconds
size_t getCyclesTillNext(const size_t microseconds) const;
private:
const bool myFixedSpeed;
std::chrono::time_point<std::chrono::steady_clock> myStartTime;
uint64_t myStartCycles;
};
}