|
| template<typename ToDur, typename Rep, typename Period, enable_if_t< is_duration< ToDur >::value, int > = 0> |
| constexpr ToDur | time_cast (const duration< Rep, Period > &value) |
| | 持续时间类型转换
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr common_type_t< duration< Rep1, Period1 >, duration< Rep2, Period2 > > | operator+ (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 加法运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr common_type_t< duration< Rep1, Period1 >, duration< Rep2, Period2 > > | operator- (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 减法运算符
|
| template<typename Rep1, typename Period, typename Rep2> |
| constexpr duration< _INNER __common_rep_t< Rep1, Rep2 >, Period > | operator* (const duration< Rep1, Period > &value, const Rep2 &scalar) |
| | 乘法运算符(持续时间 * 标量)
|
| template<typename Rep1, typename Rep2, typename Period> |
| constexpr duration< _INNER __common_rep_t< Rep2, Rep1 >, Period > | operator* (const Rep1 &scalar, const duration< Rep2, Period > &value) |
| | 乘法运算符(标量 * 持续时间)
|
| template<typename Rep1, typename Period, typename Rep2> |
| constexpr duration< _INNER __common_rep_t< Rep1, enable_if_t<!is_duration_v< Rep2 >, Rep2 > >, Period > | operator/ (const duration< Rep1, Period > &value, const Rep2 &scalar) |
| | 除法运算符(持续时间 / 标量)
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr common_type_t< Rep1, Rep2 > | operator/ (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 除法运算符(持续时间 / 持续时间)
|
| template<typename Rep1, typename Period, typename Rep2> |
| constexpr duration< _INNER __common_rep_t< Rep1, enable_if_t<!is_duration_v< Rep2 >, Rep2 > >, Period > | operator% (const duration< Rep1, Period > &value, const Rep2 &scalar) |
| | 取模运算符(持续时间 % 标量)
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr common_type_t< duration< Rep1, Period1 >, duration< Rep2, Period2 > > | operator% (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 取模运算符(持续时间 % 持续时间)
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator== (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 等于比较运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator!= (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 不等于比较运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator< (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 小于比较运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator<= (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 小于等于比较运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator> (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 大于比较运算符
|
| template<typename Rep1, typename Period1, typename Rep2, typename Period2> |
| constexpr bool | operator>= (const duration< Rep1, Period1 > &lhs, const duration< Rep2, Period2 > &rhs) |
| | 大于等于比较运算符
|
| template<typename ToDur, typename Rep, typename Period> |
| MSTL_NODISCARD constexpr enable_if_t< is_duration_v< ToDur >, ToDur > | floor (const duration< Rep, Period > &dur) |
| | 向下取整持续时间转换
|
| template<typename ToDur, typename Rep, typename Period> |
| MSTL_NODISCARD constexpr enable_if_t< is_duration_v< ToDur >, ToDur > | ceil (const duration< Rep, Period > &dur) |
| | 向上取整持续时间转换
|
| constexpr duration< decimal_t, ratio< 3600, 1 > > | operator""_h (const decimal_t hours) noexcept |
| | 小时字面量(浮点版本)
|
| template<char... Digits> |
| constexpr hours | operator""_h () noexcept |
| | 小时字面量(整型版本)
|
| constexpr duration< decimal_t, ratio< 60, 1 > > | operator""_min (const decimal_t mins) noexcept |
| | 分钟字面量(浮点版本)
|
| template<char... Digits> |
| constexpr minutes | operator""_min () noexcept |
| | 分钟字面量(整型版本)
|
| constexpr duration< decimal_t > | operator""_s (const decimal_t secs) noexcept |
| | 秒字面量(浮点版本)
|
| template<char... Digits> |
| constexpr seconds | operator""_s () noexcept |
| | 秒字面量(整型版本)
|
| constexpr duration< decimal_t, milli > | operator""_ms (const decimal_t msecs) noexcept |
| | 毫秒字面量(浮点版本)
|
| template<char... Digits> |
| constexpr milliseconds | operator""_ms () noexcept |
| | 毫秒字面量(整型版本)
|
| constexpr duration< decimal_t, micro > | operator""_us (const decimal_t usecs) noexcept |
| | 微秒字面量(浮点版本)
|
| template<char... Digits> |
| constexpr microseconds | operator""_us () noexcept |
| | 微秒字面量(整型版本)
|
| constexpr duration< decimal_t, nano > | operator""_ns (const decimal_t nsecs) noexcept |
| | 纳秒字面量(浮点版本)
|
| template<char... Digits> |
| constexpr nanoseconds | operator""_ns () noexcept |
| | 纳秒字面量(整型版本)
|
| template<typename Rep, typename Period> |
| void | sleep_for (const duration< Rep, Period > time) |
| | 使当前线程睡眠指定时间
|
MSTL持续时间类型
此文件提供了持续时间类型及相关操作,支持不同时间单位的表示和转换。
在文件 duration.hpp 中定义.