I officially want to get rid of standalone wait calls and move to a Heartbeat-based timer. I feel that this is more effective for my development as I won’t need to sleep the thread and I will be able to create interruptions (pauses or cancellations) for functions scheduled to run after a bit.
I assume that most standard games in the industry run any waiting functions with ms rather than full seconds. In addition, wait is inaccurate: it waits n
amount of seconds plus extra for an open slot in the task scheduler, meaning it can wait longer than intended.
I’ve seen a couple of nice solutions for Heartbeat-based timers and they rely on the delta time passed each time the signal is fired. This is then added to a variable, usually elapsedTime that begins at 0 and the code waits until the elapsedTime variable surpasses the time argument requested.
Is accumulative time deltas as accurate as I can get right now, or are there more accurate methods (e.g. having the timer increment each time tick()'s number increases in the hundredths place)?