毫秒时间戳 / 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 242 of file libxr_time.hpp.
243 {
244 uint32_t elapsed = 0;
245 const uint32_t max_valid = Detail::TimebaseMaxValidMs();
246
247 if (millisecond_ >= old_timestamp.millisecond_)
248 {
249 elapsed = millisecond_ - old_timestamp.millisecond_;
250 }
251 else
252 {
253 elapsed = millisecond_ + (max_valid - old_timestamp.millisecond_) + 1U;
254 }
255
256 ASSERT(elapsed <= max_valid);
257
258 return Duration(elapsed);
259 }
◆ millisecond_
| uint32_t LibXR::MillisecondTimestamp::millisecond_ = 0 |
|
private |
The documentation for this class was generated from the following file: