mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
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.
This commit is contained in:
parent
dcae6f1431
commit
dc13bb827d
5 changed files with 23 additions and 12 deletions
9
include/util/time.h
Normal file
9
include/util/time.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef UTIL_TIME_H
|
||||
#define UTIL_TIME_H
|
||||
|
||||
/**
|
||||
* Get the current time, in milliseconds.
|
||||
*/
|
||||
uint32_t get_current_time_msec(void);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue