可以用getrawmonotonic
来获取当前时间,两个时间点相减就是中间经过的时间了:
#include <linux/time.h>
static uint64_t get_cur_nsec(void) {
struct timespec time;
(&time);
getrawmonotonicreturn (uint64_t)time.tv_sec * 1000000000 + time.tv_nsec;
}
可以用getrawmonotonic
来获取当前时间,两个时间点相减就是中间经过的时间了:
Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
©2021-
searchstar
|
pv
|
uv
Theme Tree
by Wu Jun
Powered by Hexo