2020-06-05 21:44:30 +00:00
|
|
|
#ifndef UTIL_TIME_H
|
|
|
|
#define UTIL_TIME_H
|
|
|
|
|
2020-06-05 21:50:00 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
2020-06-05 21:44:30 +00:00
|
|
|
/**
|
|
|
|
* Get the current time, in milliseconds.
|
|
|
|
*/
|
|
|
|
uint32_t get_current_time_msec(void);
|
|
|
|
|
2020-06-05 21:50:00 +00:00
|
|
|
/**
|
|
|
|
* Convert a timespec to milliseconds.
|
|
|
|
*/
|
|
|
|
int64_t timespec_to_msec(const struct timespec *a);
|
|
|
|
|
2020-06-05 21:56:13 +00:00
|
|
|
/**
|
|
|
|
* Subtracts timespec `b` from timespec `a`, and stores the difference in `r`.
|
|
|
|
*/
|
|
|
|
void timespec_sub(struct timespec *r, const struct timespec *a,
|
|
|
|
const struct timespec *b);
|
|
|
|
|
2020-06-05 21:44:30 +00:00
|
|
|
#endif
|