mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
e2ceb77501
No real progress on graphics output though.
21 lines
447 B
C++
21 lines
447 B
C++
#include "timer.h"
|
|
|
|
#include "../../ClockReceiver/TimeTypes.hpp"
|
|
|
|
#include <algorithm>
|
|
#include <QDebug>
|
|
|
|
Timer::Timer(QObject *parent) : QObject(parent) {}
|
|
|
|
void Timer::setMachine(MachineTypes::TimedMachine *machine) {
|
|
this->machine = machine;
|
|
}
|
|
|
|
void Timer::tick() {
|
|
const auto now = Time::nanos_now();
|
|
const auto duration = std::min(now - lastTickNanos, int64_t(500'000));
|
|
lastTickNanos = now;
|
|
|
|
machine->run_for(double(duration) / 1e9);
|
|
}
|