libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
linux_timebase.hpp
1#include <sys/time.h>
2
3#include "timebase.hpp"
4
5extern struct timeval libxr_linux_start_time;
6
7namespace LibXR
8{
14class LinuxTimebase : public Timebase
15{
16 public:
23 {
24 struct timeval tv;
25 gettimeofday(&tv, nullptr);
26 return ((tv.tv_sec - libxr_linux_start_time.tv_sec) * 1000000 +
27 (tv.tv_usec - libxr_linux_start_time.tv_usec)) %
28 UINT32_MAX;
29 }
30
37 {
38 struct timeval tv;
39 gettimeofday(&tv, nullptr);
40 return ((tv.tv_sec - libxr_linux_start_time.tv_sec) * 1000 +
41 (tv.tv_usec - libxr_linux_start_time.tv_usec) / 1000) %
42 UINT32_MAX;
43 }
44};
45} // namespace LibXR
LinuxTimebase 类,用于获取 Linux 系统的时间基准。Provides a timebase for Linux systems.
TimestampMS _get_milliseconds()
获取当前时间戳(毫秒级)
TimestampUS _get_microseconds()
获取当前时间戳(微秒级)。Returns the current timestamp in microseconds.
时间基类,用于提供高精度时间戳。 Timebase class for providing high-precision timestamps.
Definition timebase.hpp:18
表示毫秒级时间戳的类。Class representing a timestamp in milliseconds.
表示微秒级时间戳的类。Class representing a timestamp in microseconds.
LibXR Color Control Library / LibXR终端颜色控制库