30 microseconds_ = microseconds;
103 return static_cast<float_t>(microseconds_) / 1000000.0f;
111 return static_cast<float_t>(microseconds_) / 60000000.0f;
119 return static_cast<float_t>(microseconds_) / 3600000000.0f;
139 microseconds_ =
static_cast<size_t>(seconds * 1000000.0f);
160 return TimeDuration(microseconds_ + other.microseconds_);
169 return TimeDuration(microseconds_ - other.microseconds_);
196 return microseconds_ == other.microseconds_;
205 return !(*
this == other);
214 return microseconds_ < other.microseconds_;
223 return microseconds_ > other.microseconds_;
232 return microseconds_ <= other.microseconds_;
241 return microseconds_ >= other.microseconds_;
249 if (microseconds_ < 1000) {
250 return std::to_string(microseconds_) +
"us";
251 }
else if (microseconds_ < 1000000) {
252 return std::to_string(milliseconds()) +
"ms";
254 return std::to_string(seconds()) +
"s";
void set_minutes(float_t minutes)
设置分钟数
void set_milliseconds(size_t ms)
设置毫秒值
float_t hours() const
获取小时数
static TimeDuration from_microseconds(size_t us)
从微秒创建时间段
bool operator<(const TimeDuration &other) const
时间段小于比较
bool operator>=(const TimeDuration &other) const
时间段大于等于比较
static TimeDuration from_milliseconds(size_t ms)
从毫秒创建时间段
bool operator!=(const TimeDuration &other) const
时间段不等比较
TimeDuration(float_t seconds)
从浮点数秒构造函数
TimeDuration(size_t microseconds)
从微秒值构造函数
std::string to_string() const
转换为字符串表示
static TimeDuration from_minutes(float_t minutes)
从分钟创建时间段
TimeDuration operator+(const TimeDuration &other) const
时间段加法运算
TimeDuration operator-(const TimeDuration &other) const
时间段减法运算
void set_seconds(float_t seconds)
设置秒数
size_t milliseconds() const
获取毫秒值
TimeDuration operator/(size_t divisor) const
时间段除法运算
size_t microseconds() const
获取微秒值
static TimeDuration from_hours(float_t hours)
从小时创建时间段
float_t minutes() const
获取分钟数
bool operator==(const TimeDuration &other) const
时间段相等比较
float_t seconds() const
获取秒数
TimeDuration operator*(size_t multiplier) const
时间段乘法运算
static TimeDuration from_seconds(float_t seconds)
从秒创建时间段
void set_hours(float_t hours)
设置小时数
bool operator<=(const TimeDuration &other) const
时间段小于等于比较
bool operator>(const TimeDuration &other) const
时间段大于比较
void set_microseconds(size_t us)
设置微秒值
#define XCAL_PROPERTY_TYPE(type)