![]() |
TSDuck v3.44-4572
MPEG Transport Stream Toolkit
|
The ISOTime class convert dates, times, and durations with ISO 8601 representation.
More...
#include <tsISOTime.h>
Public Types | |
| enum | TimeType { NONE = 0x00 , TIME = 0x01 , DURATION = 0x02 , START_END = 0x04 , START_DURATION = 0x08 , DURATION_END = 0x10 , RECURRING = 0x20 , ANY_INTERVAL = 0x1E , ANY = 0x3F } |
| Type of time data which can be represented in ISO 8601. More... | |
Public Member Functions | |
| ISOTime ()=default | |
| Default constructor. | |
| template<class Rep , class Period > | |
| ISOTime (cn::duration< Rep, Period > duration, const Time &end, size_t recurrences=0) | |
| Constructor using a duration and an end. | |
| template<class Rep , class Period > | |
| ISOTime (cn::duration< Rep, Period > duration, size_t recurrences=0) | |
| Constructor using a duration not associated with any start or end. | |
| template<class Rep , class Period > | |
| ISOTime (const Time &start, cn::duration< Rep, Period > duration, size_t recurrences=0) | |
| Constructor using a start and a duration. | |
| ISOTime (const Time &start, const Time &end, size_t recurrences=0) | |
| Constructor using a start and end date. | |
| ISOTime (const Time &time) | |
| Constructor using one date & time value. | |
| ISOTime (const UString &str) | |
| Constructor from a string in ISO 8601 format. | |
| void | clear () |
| Reset the content of the object to an invalid state. | |
| cn::milliseconds | duration () const |
| Get the duration of the time interval. | |
| Time | end () const |
| Get the time interval end time. | |
| bool | fromString (const UString &str) |
| Set the value of this object from a string in ISO 8601 format. | |
| bool | isInterval () const |
| Check if this object contains a time interval (recurring or not). | |
| bool | isRecurring () const |
| Check if this object contains a recurring interval. | |
| bool | isSingleTime () const |
| Check if this object contains a single date & time value. | |
| bool | isUnbounded () const |
| Check if this object contains an unbounded recurring interval. | |
| bool | isValid () const |
| Check if this object contains a valid value. | |
| operator Time () const | |
| Conversion to a Time value. | |
| size_t | recurrences () const |
| Get the number of recurrences of the time interval. | |
| Time | start () const |
| Get the time interval start time. | |
| UString | toString (TimeType format=NONE) const |
| Format this object as a ISO 8601 string. | |
| TimeType | type () const |
| Get the type of ISO 8601 time data. | |
Static Public Member Functions | |
| static cn::milliseconds | DurationFromISO (const UString &str) |
| Decode a duration from an ISO 8601 representation. | |
| static Time | TimeFromISO (const UString &str) |
| Decode a time from an ISO 8601 representation. | |
| template<class Rep , class Period > | |
| static UString | ToISO (cn::duration< Rep, Period > duration) |
| Format a duration in ISO 8601 representation. | |
| static UString | ToISO (const Time &time) |
| Format a time in ISO 8601 representation. | |
| template<class Rep , class Period > | |
| static UString | ToISO (const Time &time, cn::duration< Rep, Period > utc_offset) |
| Format a time in ISO 8601 representation, including an offset from UTC time. | |
Static Public Attributes | |
| static constexpr size_t | UNBOUNDED_RECURRENCES = std::numeric_limits<size_t>::max() |
| Number of time-interval recurrences meaning "unbounded". | |
The ISOTime class convert dates, times, and durations with ISO 8601 representation.
Type of time data which can be represented in ISO 8601.
|
inline |
Constructor from a string in ISO 8601 format.
| [in] | str | A string in ISO 8601 format. |
|
inline |
Constructor using one date & time value.
| [in] | time | The date & time to set. |
|
inline |
Constructor using a duration not associated with any start or end.
| [in] | duration | Time interval duration. |
| [in] | recurrences | If non-zero, the time-interval is recurring, with that number of recurrences. |
Constructor using a start and end date.
| [in] | start | Interval start time. |
| [in] | end | Interval end time. |
| [in] | recurrences | If non-zero, the time-interval is recurring, with that number of recurrences. |
|
inline |
Constructor using a start and a duration.
| [in] | start | Interval start time. |
| [in] | duration | Time interval duration. |
| [in] | recurrences | If non-zero, the time-interval is recurring, with that number of recurrences. |
|
inline |
Constructor using a duration and an end.
| [in] | duration | Time interval duration. |
| [in] | end | Interval end time. |
| [in] | recurrences | If non-zero, the time-interval is recurring, with that number of recurrences. |
|
inline |
Check if this object contains a valid value.
|
inline |
Check if this object contains a single date & time value.
|
inline |
Check if this object contains a time interval (recurring or not).
|
inline |
Check if this object contains a recurring interval.
|
inline |
Check if this object contains an unbounded recurring interval.
|
inline |
Get the type of ISO 8601 time data.
Format this object as a ISO 8601 string.
| [in] | format | Required format. In NONE, use the default format for that object. |
| bool ts::ISOTime::fromString | ( | const UString & | str | ) |
Set the value of this object from a string in ISO 8601 format.
| [in] | str | A string in ISO 8601 format. |
|
inline |
Conversion to a Time value.
| Time ts::ISOTime::start | ( | ) | const |
Get the time interval start time.
| Time ts::ISOTime::end | ( | ) | const |
Get the time interval end time.
| cn::milliseconds ts::ISOTime::duration | ( | ) | const |
Get the duration of the time interval.
|
inline |
Get the number of recurrences of the time interval.
Decode a time from an ISO 8601 representation.
Missing date fields default to the current UTC time. Missing time fields default to zero. The mpeg7:timePointType format is an extension of ISO 8601 and is also recognized here.
| [in] | str | A string describing a date and time in ISO 8601 representation. |
|
static |
Decode a duration from an ISO 8601 representation.
| [in] | str | A string describing a duration in ISO 8601 representation. |
Format a time in ISO 8601 representation.
| [in] | time | The date and time to format. |
|
inlinestatic |
Format a time in ISO 8601 representation, including an offset from UTC time.
| [in] | time | The date and time to format. |
| [in] | utc_offset | The offset from UTC time to include in the representation. |
|
inlinestatic |
Format a duration in ISO 8601 representation.
| [in] | duration | Time interval duration. |