Synchronized sleeping. More...
#include <Radiant/Sleep.hpp>
Public Member Functions | |
| void | resetTiming () |
| Resets the reference time to current time. | |
| SleepSync () | |
| The constructor resets the timing. | |
| void | sleepSynchroUs (long us) |
| Sleep for n microseconds. More... | |
Synchronized sleeping.
This class can be used to execute a piece of code in fixed intervals. Here's a simple example where a loop cycle is executed every 100ms:
| void Radiant::SleepSync::sleepSynchroUs | ( | long | us | ) |
Sleep for n microseconds.
This function calculates how much time has passed since the
last sleep and sleeps to fulfill the required time period.
| us | microseconds to sleep |