diff options
Diffstat (limited to 'timer/include')
| -rw-r--r-- | timer/include/timer.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/timer/include/timer.h b/timer/include/timer.h index 6dc87d9..75ae367 100644 --- a/timer/include/timer.h +++ b/timer/include/timer.h | |||
| @@ -21,10 +21,10 @@ typedef uint64_t time_delta; | |||
| 21 | 21 | ||
| 22 | /// A high resolution timer. | 22 | /// A high resolution timer. |
| 23 | typedef struct Timer { | 23 | typedef struct Timer { |
| 24 | time_point start_time; // The instant the timer was last started. | 24 | time_point start_time; ///< The instant the timer was last started. |
| 25 | time_point last_tick; // The instant the timer was last ticked. | 25 | time_point last_tick; ///< The instant the timer was last ticked. |
| 26 | time_delta running_time; // Time elapsed since the timer was last started. | 26 | time_delta running_time; ///< Time elapsed since the timer was last started. |
| 27 | time_delta delta_time; // Time elapsed since the last tick. | 27 | time_delta delta_time; ///< Time elapsed since the last tick. |
| 28 | } Timer; | 28 | } Timer; |
| 29 | 29 | ||
| 30 | /// Construct a new timer. | 30 | /// Construct a new timer. |
| @@ -38,6 +38,15 @@ void timer_start(Timer*); | |||
| 38 | /// Update the timer's running and delta times. | 38 | /// Update the timer's running and delta times. |
| 39 | void timer_tick(Timer*); | 39 | void timer_tick(Timer*); |
| 40 | 40 | ||
| 41 | /// Advance the timer. | ||
| 42 | /// | ||
| 43 | /// This is used for simulations that wish control over time. It should not be | ||
| 44 | /// used together with timer_tick(). | ||
| 45 | /// | ||
| 46 | /// The input time is relative to the timer's start time. Successive calls to | ||
| 47 | /// this function must use increasing values of time. | ||
| 48 | void timer_advance(Timer* timer, time_delta t); | ||
| 49 | |||
| 41 | /// Get the current time. | 50 | /// Get the current time. |
| 42 | time_point time_now(void); | 51 | time_point time_now(void); |
| 43 | 52 | ||
