libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::MicrosecondTimestamp::Duration Class Reference

微秒时长 / Duration in microseconds More...

#include <libxr_time.hpp>

Public Member Functions

 Duration (uint64_t diff)
 从微秒差值构造时长 / Construct a duration from a microsecond delta
 
 operator uint64_t () const
 转换为微秒差值 / Convert to the raw microsecond delta
 
double ToSecond () const
 转换为秒 / Convert the duration to seconds
 
float ToSecondf () const
 转换为单精度秒 / Convert the duration to seconds in single precision
 
uint64_t ToMicrosecond () const
 转换为微秒 / Convert the duration to microseconds
 
uint32_t ToMillisecond () const
 转换为毫秒 / Convert the duration to milliseconds
 

Private Attributes

uint64_t diff_ = 0
 

Detailed Description

微秒时长 / Duration in microseconds

Definition at line 69 of file libxr_time.hpp.

Constructor & Destructor Documentation

◆ Duration()

LibXR::MicrosecondTimestamp::Duration::Duration ( uint64_t diff)
inline

从微秒差值构造时长 / Construct a duration from a microsecond delta

Parameters
diff微秒差值 / Microsecond delta

Definition at line 76 of file libxr_time.hpp.

76: diff_(diff) {}

Member Function Documentation

◆ operator uint64_t()

LibXR::MicrosecondTimestamp::Duration::operator uint64_t ( ) const
inline

转换为微秒差值 / Convert to the raw microsecond delta

Returns
微秒差值 / Raw microsecond delta

Definition at line 82 of file libxr_time.hpp.

82{ return diff_; }

◆ ToMicrosecond()

uint64_t LibXR::MicrosecondTimestamp::Duration::ToMicrosecond ( ) const
inlinenodiscard

转换为微秒 / Convert the duration to microseconds

Returns
微秒 / Microseconds

Definition at line 106 of file libxr_time.hpp.

106{ return diff_; }

◆ ToMillisecond()

uint32_t LibXR::MicrosecondTimestamp::Duration::ToMillisecond ( ) const
inlinenodiscard

转换为毫秒 / Convert the duration to milliseconds

Returns
毫秒 / Milliseconds

Definition at line 112 of file libxr_time.hpp.

112{ return diff_ / 1000u; }

◆ ToSecond()

double LibXR::MicrosecondTimestamp::Duration::ToSecond ( ) const
inlinenodiscard

转换为秒 / Convert the duration to seconds

Returns
秒 / Seconds

Definition at line 88 of file libxr_time.hpp.

89 {
90 return static_cast<double>(diff_) / 1000000.0;
91 }

◆ ToSecondf()

float LibXR::MicrosecondTimestamp::Duration::ToSecondf ( ) const
inlinenodiscard

转换为单精度秒 / Convert the duration to seconds in single precision

Returns
单精度秒 / Seconds in single precision

Definition at line 97 of file libxr_time.hpp.

98 {
99 return static_cast<float>(diff_) / 1000000.0f;
100 }

Field Documentation

◆ diff_

uint64_t LibXR::MicrosecondTimestamp::Duration::diff_ = 0
private

Definition at line 115 of file libxr_time.hpp.


The documentation for this class was generated from the following file: