A signed duration: seconds plus nanoseconds of the same sign, the latter within ±999999999, so -1.5 s is {-1, -500000000}.
More...
#include <temporal_types.h>
|
| template<typename Duration = std::chrono::nanoseconds> |
| std::optional< Duration > | to_chrono () const |
| | The same duration as a std::chrono::duration, or std::nullopt when it is not a whole number of the duration's units or does not fit in its representation.
|
|
| template<typename Rep, typename Period> |
| static std::optional< SignedDuration > | from_chrono (std::chrono::duration< Rep, Period > duration) |
| | The SignedDuration of a std::chrono::duration, or std::nullopt when its seconds do not fit in int64_t.
|
|
|
int64_t | seconds = 0 |
| | Whole seconds.
|
|
int32_t | nanoseconds = 0 |
| | Nanoseconds, of the sign of seconds.
|
A signed duration: seconds plus nanoseconds of the same sign, the latter within ±999999999, so -1.5 s is {-1, -500000000}.
Prints in the ISO 8601 duration form PT1H30M5.5S, with a leading - when negative and PT0S for zero.
◆ from_chrono()
template<typename Rep, typename Period>
| std::optional< SignedDuration > hegel::generators::temporal::SignedDuration::from_chrono |
( |
std::chrono::duration< Rep, Period > | duration | ) |
|
|
inlinestatic |
The SignedDuration of a std::chrono::duration, or std::nullopt when its seconds do not fit in int64_t.
- Parameters
-
| duration | The duration to convert. |
- Returns
- The duration, or std::nullopt.
◆ to_chrono()
template<typename Duration = std::chrono::nanoseconds>
| std::optional< Duration > hegel::generators::temporal::SignedDuration::to_chrono |
( |
| ) |
const |
|
inline |
The same duration as a std::chrono::duration, or std::nullopt when it is not a whole number of the duration's units or does not fit in its representation.
- Template Parameters
-
| Duration | A std::chrono::duration whose period is a standard unit; std::chrono::nanoseconds by default. |
- Returns
- The duration, or std::nullopt.
The documentation for this struct was generated from the following file: