微秒时间戳 / Microsecond timestamp
More...
#include <libxr_time.hpp>
微秒时间戳 / Microsecond timestamp
Definition at line 46 of file libxr_time.hpp.
◆ MicrosecondTimestamp()
| LibXR::MicrosecondTimestamp::MicrosecondTimestamp |
( |
uint64_t | microsecond | ) |
|
|
inline |
从微秒计数构造时间戳 / Construct a timestamp from microsecond ticks
- Parameters
-
| microsecond | 微秒计数值 / Microsecond tick count |
Definition at line 58 of file libxr_time.hpp.
58: microsecond_(microsecond) {}
◆ operator uint64_t()
| LibXR::MicrosecondTimestamp::operator uint64_t |
( |
| ) |
const |
|
inline |
转换为微秒计数值 / Convert to the raw microsecond tick count
- Returns
- 微秒计数值 / Raw microsecond tick count
Definition at line 64 of file libxr_time.hpp.
64{ return microsecond_; }
◆ operator-()
计算时间差,支持时间基准回绕 / Compute elapsed time with timebase wraparound
- Parameters
-
| old_timestamp | 旧时间戳 / Older timestamp |
- Returns
- 当前时间戳相对旧时间戳的时长 / Elapsed duration from the older timestamp
- Note
- 若当前时间戳小于旧时间戳,则按一次时间基准回绕处理,回绕上界由 当前已配置的微秒时间基准有效上界指定。 / If the current timestamp is smaller than the older one, the function treats it as one wraparound event whose upper bound is defined by the currently configured microsecond timebase limit.
Definition at line 129 of file libxr_time.hpp.
130 {
131 uint64_t elapsed = 0;
132 const uint64_t max_valid = Detail::TimebaseMaxValidUs();
133
134 if (microsecond_ >= old_timestamp.microsecond_)
135 {
136 elapsed = microsecond_ - old_timestamp.microsecond_;
137 }
138 else
139 {
140 elapsed = microsecond_ + (max_valid - old_timestamp.microsecond_) + 1ULL;
141 }
142
143 ASSERT(elapsed <= max_valid);
144
145 return Duration(elapsed);
146 }
◆ operator=()
复制赋值 / Copy-assign from another timestamp
- Parameters
-
| other | 源时间戳 / Source timestamp |
- Returns
- 当前对象引用 / Reference to this object
◆ microsecond_
| uint64_t LibXR::MicrosecondTimestamp::microsecond_ = 0 |
|
private |
The documentation for this class was generated from the following file: