A structure representing a time interval, supporting granularity in days, hours, minutes, seconds, and milliseconds.
More...
#include <sttnet_English.h>
A structure representing a time interval, supporting granularity in days, hours, minutes, seconds, and milliseconds.
- Note
- 1. Provides basic operations on time intervals, such as addition, subtraction, comparison, and unit conversion.
-
2. This structure does not represent an absolute time point, but only the difference between two time points.
-
3. The internal implementation uses multiple fields instead of a unified timestamp to improve readability and controllability.
| stt::time::Duration::Duration |
( |
long long |
a, |
|
|
int |
b, |
|
|
int |
c, |
|
|
int |
d, |
|
|
int |
e |
|
) |
| |
|
inline |
Constructor, taking days, hours, minutes, seconds, milliseconds.
| stt::time::Duration::Duration |
( |
| ) |
|
|
default |
| double stt::time::Duration::convertToDay |
( |
| ) |
|
|
inline |
Convert the current time interval to a floating-point representation in days.
| double stt::time::Duration::convertToHour |
( |
| ) |
|
|
inline |
Convert the current time interval to a floating-point representation in hours.
| double stt::time::Duration::convertToMin |
( |
| ) |
|
|
inline |
Convert the current time interval to a floating-point representation in minutes.
| long long stt::time::Duration::convertToMsec |
( |
| ) |
|
|
inline |
Convert the current time interval to total milliseconds.
| double stt::time::Duration::convertToSec |
( |
| ) |
|
|
inline |
Convert the current time interval to a floating-point representation in seconds.
Add two time intervals.
- Parameters
-
- Returns
- The resulting Duration after addition.
Calculate the difference between two time intervals (current object minus parameter b).
- Parameters
-
- Returns
- The resulting Duration of the difference.
| bool stt::time::Duration::operator< |
( |
const Duration & |
b | ) |
|
|
inline |
Determine if the current time interval is less than another time interval.
- Parameters
-
- Returns
- True if the current object is less than parameter b, otherwise false.
| bool stt::time::Duration::operator<= |
( |
const Duration & |
b | ) |
|
|
inline |
Determine if the current time interval is less than or equal to another time interval.
- Parameters
-
- Returns
- True if the current object is less than or equal to parameter b, otherwise false.
| bool stt::time::Duration::operator== |
( |
const Duration & |
b | ) |
|
|
inline |
Determine if the current time interval is equal to another time interval.
- Parameters
-
- Returns
- True if the current object is equal to parameter b, otherwise false.
| bool stt::time::Duration::operator> |
( |
const Duration & |
b | ) |
|
|
inline |
Determine if the current time interval is greater than another time interval.
- Parameters
-
- Returns
- True if the current object is greater than parameter b, otherwise false.
| bool stt::time::Duration::operator>= |
( |
const Duration & |
b | ) |
|
|
inline |
Determine if the current time interval is greater than or equal to another time interval.
- Parameters
-
- Returns
- True if the current object is greater than or equal to parameter b, otherwise false.
| Duration stt::time::Duration::recoverForm |
( |
const long long & |
t | ) |
|
|
inline |
Recover the standard days-hours-minutes-seconds-milliseconds format from given milliseconds.
- Parameters
-
| t | The millisecond value to recover. |
- Returns
- The converted Duration.
| 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 |
The documentation for this struct was generated from the following file: