1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Uses objective clock for updates.

This commit is contained in:
Thomas Harte 2020-02-04 22:24:54 -05:00
parent 5caf74b930
commit e7410b8ed8

View File

@ -720,10 +720,16 @@ struct ActivityObserver: public Activity::Observer {
#define TICKS 600
- (void)start {
__block auto lastTime = std::chrono::high_resolution_clock::now().time_since_epoch().count();
_timer = [[CSHighPrecisionTimer alloc] initWithTask:^{
const auto timeNow = std::chrono::high_resolution_clock::now().time_since_epoch().count();
const auto duration = timeNow - lastTime;
lastTime = timeNow;
CGSize pixelSize;
@synchronized(self) {
self->_machine->crt_machine()->run_for(1.0 / double(TICKS));
self->_machine->crt_machine()->run_for((double)duration / 1e9);
pixelSize = self->_pixelSize;
}