毫秒时间戳 / Millisecond timestamp
More...
#include <libxr_time.hpp>
|
|
| MillisecondTimestamp ()=default |
| | 创建零值毫秒时间戳 / Construct a zero millisecond timestamp
|
| |
| | MillisecondTimestamp (uint32_t millisecond) |
| | 从毫秒计数构造时间戳 / Construct a timestamp from millisecond ticks
|
| |
| | operator uint32_t () const |
| | 转换为毫秒计数值 / Convert to the raw millisecond tick count
|
| |
| Duration | operator- (const MillisecondTimestamp &old_timestamp) const |
| | 计算时间差,支持时间基准回绕 / Compute elapsed time with timebase wraparound
|
| |
毫秒时间戳 / Millisecond timestamp
Definition at line 162 of file libxr_time.hpp.
◆ MillisecondTimestamp()
| LibXR::MillisecondTimestamp::MillisecondTimestamp |
( |
uint32_t | millisecond | ) |
|
|
inline |
从毫秒计数构造时间戳 / Construct a timestamp from millisecond ticks
- Parameters
-
| millisecond | 毫秒计数值 / Millisecond tick count |
Definition at line 174 of file libxr_time.hpp.
174: millisecond_(millisecond) {}
◆ operator uint32_t()
| LibXR::MillisecondTimestamp::operator uint32_t |
( |
| ) |
const |
|
inline |
转换为毫秒计数值 / Convert to the raw millisecond tick count
- Returns
- 毫秒计数值 / Raw millisecond tick count
Definition at line 180 of file libxr_time.hpp.
180{ return millisecond_; }
◆ 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 millisecond timebase limit.
Definition at line 248 of file libxr_time.hpp.
249 {
250 uint32_t elapsed = 0;
251 const uint32_t max_valid = Detail::TimebaseMaxValidMs();
252
253 if (millisecond_ >= old_timestamp.millisecond_)
254 {
255 elapsed = millisecond_ - old_timestamp.millisecond_;
256 }
257 else
258 {
259 elapsed = millisecond_ + (max_valid - old_timestamp.millisecond_) + 1U;
260 }
261
262 ASSERT(elapsed <= max_valid);
263
264 return Duration(elapsed);
265 }
◆ millisecond_
| uint32_t LibXR::MillisecondTimestamp::millisecond_ = 0 |
|
private |
The documentation for this class was generated from the following file: