Commit Graph

7 Commits

Author SHA1 Message Date
Kirill Primak 3dc646ea88 Add some missing includes/declarations 2023-06-05 21:06:19 +00:00
Rose Hudson bd834fe8d1 util: add timespec_to_nsec 2023-06-05 19:50:07 +00:00
Simon Ser 769cabbadf util/time: use int64_t return value for get_current_time_msec()
0xFFFFFFFF milliseconds is 4,294,967,295 ms so about 50 days.
A little bit too close for comfort.

Use int64_t instead of uint64_t to avoid C's implicit conversion
footguns in computations.
2022-11-25 16:15:29 +00:00
Simon Ser f0c1b32120 util/time: add timespec_from_nsec 2020-12-18 10:37:08 +01:00
Tudor Brindus 363bf44a35 util/time: move `timespec_sub` to time utilities 2020-06-06 00:09:19 +02:00
Tudor Brindus c9c31f803e util/time: de-duplicate `timespec_to_msec` 2020-06-06 00:09:19 +02:00
Tudor Brindus dc13bb827d util: fix and move `get_current_time_msec` into a util file
This commit makes `get_current_time_msec` correctly return milliseconds
as opposed to microseconds. It also considers the value of `tv_sec`, so
we don't lose occasionally go back in time by one second. Finally, the
function is moved into `util/time.cc` so that it can be reused elsewhere
without having to consider these pitfalls.
2020-06-06 00:09:19 +02:00