2023-12-07 09:20:23 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: IAsyncTimer.hpp
|
|
|
|
Date: 2023-12-06
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::Async
|
|
|
|
{
|
|
|
|
struct IAsyncTimer
|
|
|
|
{
|
|
|
|
virtual void CancelTimer() = 0;
|
|
|
|
virtual AuUInt64 GetLastTime() = 0;
|
2024-05-19 16:01:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get tick count (always non-zero after or during initial trigger)
|
|
|
|
*/
|
2023-12-07 09:20:23 +00:00
|
|
|
virtual AuUInt64 GetTicks() = 0;
|
2024-05-19 16:01:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Default: false
|
|
|
|
* When in catch up mode, timer ticks can be scheduled in the past, otherwise the next time is clamped to the current time.
|
|
|
|
* Latterly, it is possible to get stuck in a spin with no interval, however if the system lags behind momentarily, recovery is instantaneous.
|
|
|
|
* On platforms with process suspension, specify no catch up.
|
|
|
|
* On servers or other tick-sensitive applications (like a clock GUI), specify catch up.
|
|
|
|
*/
|
|
|
|
virtual bool IsCatchUp() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* See: IsCatchUp
|
|
|
|
*/
|
|
|
|
virtual void SetCatchUp(bool bCatchUp) = 0;
|
2023-12-07 09:20:23 +00:00
|
|
|
};
|
|
|
|
}
|