diff options
Diffstat (limited to 'timer/include')
| -rw-r--r-- | timer/include/timer.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/timer/include/timer.h b/timer/include/timer.h index 94781d6..6dc87d9 100644 --- a/timer/include/timer.h +++ b/timer/include/timer.h | |||
| @@ -20,7 +20,7 @@ typedef struct timespec time_point; | |||
| 20 | typedef uint64_t time_delta; | 20 | typedef uint64_t time_delta; |
| 21 | 21 | ||
| 22 | /// A high resolution timer. | 22 | /// A high resolution timer. |
| 23 | typedef struct { | 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. |
| @@ -53,6 +53,9 @@ time_delta sec_to_time_delta(double seconds); | |||
| 53 | /// Convert the time point to nanoseconds. | 53 | /// Convert the time point to nanoseconds. |
| 54 | uint64_t time_point_to_ns(time_point); | 54 | uint64_t time_point_to_ns(time_point); |
| 55 | 55 | ||
| 56 | /// Add a time delta to a timestamp. | ||
| 57 | time_point time_add(time_point, time_delta); | ||
| 58 | |||
| 56 | /// Put the caller thread to sleep for the given amount of time. | 59 | /// Put the caller thread to sleep for the given amount of time. |
| 57 | void time_sleep(time_delta dt); | 60 | void time_sleep(time_delta dt); |
| 58 | 61 | ||
