|
STTNet 0.7.0
|
表示时间间隔的结构体,支持天、小时、分钟、秒和毫秒粒度。 More...
#include <sttnet.h>
Public Member Functions | |
| Duration (long long a, int b, int c, int d, int e) | |
| 构造函数,传入天,时,分,秒,毫秒 | |
| Duration ()=default | |
| bool | operator> (const Duration &b) |
| 判断当前时间间隔是否大于另一个时间间隔。 | |
| bool | operator< (const Duration &b) |
| 判断当前时间间隔是否小于另一个时间间隔。 | |
| bool | operator== (const Duration &b) |
| 判断当前时间间隔是否等于另一个时间间隔。 | |
| bool | operator>= (const Duration &b) |
| 判断当前时间间隔是否大于等于另一个时间间隔。 | |
| bool | operator<= (const Duration &b) |
| 判断当前时间间隔是否小于等于另一个时间间隔。 | |
| Duration | operator+ (const Duration &b) |
| 将两个时间间隔相加。 | |
| Duration | operator- (const Duration &b) |
| 计算两个时间间隔的差值(当前对象减去参数 b)。 | |
| double | convertToDay () |
| 将当前时间间隔转换为以“天”为单位的浮点数表示。 | |
| double | convertToHour () |
| 将当前时间间隔转换为以“小时”为单位的浮点数表示。 | |
| double | convertToMin () |
| 将当前时间间隔转换为以“分钟”为单位的浮点数表示。 | |
| double | convertToSec () |
| 将当前时间间隔转换为以“秒”为单位的浮点数表示。 | |
| long long | convertToMsec () |
| 将当前时间间隔转换为总毫秒数。 | |
| Duration | recoverForm (const long long &t) |
| 从给定的毫秒数恢复为标准的天-时-分-秒-毫秒格式。 | |
Public Attributes | |
| long long | day |
| 天 | |
| int | hour |
| 时 | |
| int | min |
| 分 | |
| int | sec |
| 秒 | |
| int | msec |
| 毫秒 | |
STTNet's non-negative elapsed-interval type with day, hour, minute, second, and millisecond fields.
(day, hour, min, sec, msec); default construction represents zero milliseconds.DateTime::checkTime(), endTiming(), and getDt() all return Duration.recoverForm(totalMs) modifies the object. Negative, invalid, or overflowing results use the all-minus-one invalid sentinel.invalid(), isValid(), and tryConvertToMsec(). See include/sttnet.h for exact signatures.
|
inline |
构造函数,传入天,时,分,秒,毫秒
|
default |
|
inline |
将当前时间间隔转换为以“天”为单位的浮点数表示。
|
inline |
将当前时间间隔转换为以“小时”为单位的浮点数表示。
|
inline |
将当前时间间隔转换为以“分钟”为单位的浮点数表示。
|
inline |
将当前时间间隔转换为总毫秒数。
|
inline |
将当前时间间隔转换为以“秒”为单位的浮点数表示。
将两个时间间隔相加。
| b | 要相加的另一个 Duration。 |
计算两个时间间隔的差值(当前对象减去参数 b)。
| b | 要减去的另一个 Duration。 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
从给定的毫秒数恢复为标准的天-时-分-秒-毫秒格式。
| t | 要恢复的毫秒值。 |
| long long stt::time::Duration::day |
天
| int stt::time::Duration::hour |
时
| int stt::time::Duration::min |
分
| int stt::time::Duration::msec |
毫秒
| int stt::time::Duration::sec |
秒