![]() |
NDEVR
API Documentation
|
Stores a time span, or difference between two times, with an optional start time. More...
Public Member Functions | |
| constexpr | TimeSpan () |
| Constructs an invalid TimeSpan with no start time and an invalid elapsed duration. | |
| constexpr | TimeSpan (const fltp08 elapsed_seconds) |
| Constructs a TimeSpan from a duration in seconds with no start time. | |
| constexpr | TimeSpan (const sint08 elapsed_nano_seconds) |
| Constructs a TimeSpan from a signed 64-bit nanosecond duration with no start time. | |
| constexpr | TimeSpan (const Time &start, const fltp08 &elapsed_seconds) |
| Constructs a TimeSpan from a start time and an elapsed duration in seconds. | |
| constexpr | TimeSpan (const Time &start, const sint08 &elapsed_nano_seconds) |
| Constructs a TimeSpan from a start time and an elapsed nanosecond duration. | |
| TimeSpan (const Time &start, const Time &end) | |
| Constructs a TimeSpan from a start and end time, computing the elapsed duration. | |
| constexpr | TimeSpan (const uint08 elapsed_nano_seconds) |
| Constructs a TimeSpan from an unsigned 64-bit nanosecond duration with no start time. | |
| constexpr | TimeSpan (sint04 elapsed_nano_seconds) |
| Constructs a TimeSpan from a signed 32-bit nanosecond duration with no start time. | |
| constexpr | TimeSpan (uint04 elapsed_nano_seconds) |
| Constructs a TimeSpan from an unsigned 32-bit nanosecond duration with no start time. | |
| bool | contains (const Time &time) const |
| Checks whether the given time falls within this time span. | |
| sint08 | elapsedDays () const |
| Returns the elapsed duration in whole days, accounting for calendar boundaries. | |
| constexpr fltp08 | elapsedHours () const |
| Returns the elapsed duration in hours. | |
| template<class t_type = fltp08> | |
| constexpr t_type | elapsedMilliseconds () const |
| Returns the elapsed duration in milliseconds. | |
| constexpr fltp08 | elapsedMinutes () const |
| Returns the elapsed duration in minutes. | |
| sint08 | elapsedMonths () const |
| Returns the elapsed duration in whole months, accounting for calendar boundaries. | |
| constexpr sint08 | elapsedNanoseconds () const |
| Returns the elapsed duration in nanoseconds. | |
| fltp08 | elapsedPercent (Time time, bool clip_time) const |
| Computes the percentage of elapsed time at a given point within this span. | |
| constexpr fltp08 | elapsedSeconds () const |
| Returns the elapsed duration in seconds. | |
| Time | endTime () const |
| Computes the end time by adding the elapsed duration to the start time. | |
| String | getTimeString (const StringView &format_string) const |
| Formats the time span as a human-readable string using the given format. | |
| constexpr bool | operator!= (const TimeSpan &time) const |
| Checks inequality of start time or elapsed duration. | |
| constexpr TimeSpan | operator* (const fltp08 &mult) const |
| Multiplies the elapsed duration by a floating-point factor. | |
| constexpr TimeSpan | operator* (const sint08 &mult) const |
| Multiplies the elapsed duration by an integer factor. | |
| constexpr TimeSpan & | operator*= (const fltp08 &mult) |
| Multiplies the elapsed duration in place by a floating-point factor. | |
| constexpr TimeSpan & | operator*= (const sint08 &mult) |
| Multiplies the elapsed duration in place by an integer factor. | |
| constexpr TimeSpan | operator+ (const TimeSpan &other) const |
| Adds two time spans, combining their elapsed durations. | |
| constexpr TimeSpan & | operator+= (const TimeSpan &other) |
| Adds another span's elapsed duration to this one in place. | |
| constexpr TimeSpan | operator- () const |
| Negates the elapsed duration of this time span. | |
| constexpr TimeSpan | operator- (const TimeSpan &other) const |
| Subtracts another span's elapsed duration from this one. | |
| constexpr TimeSpan & | operator-= (const TimeSpan &other) |
| Subtracts another span's elapsed duration from this one in place. | |
| constexpr TimeSpan | operator/ (const fltp08 &den) const |
| Divides the elapsed duration by a floating-point denominator. | |
| constexpr TimeSpan | operator/ (const sint08 &den) const |
| Divides the elapsed duration by an integer denominator. | |
| constexpr fltp08 | operator/ (const TimeSpan &time_2) const |
| Divides this span by another, returning the ratio of elapsed durations. | |
| constexpr bool | operator< (const TimeSpan &other) const |
| Compares elapsed durations, ignoring start time. | |
| constexpr bool | operator<= (const TimeSpan &other) const |
| Compares elapsed durations, ignoring start time. | |
| constexpr bool | operator== (const TimeSpan &time) const |
| Checks equality of both start time and elapsed duration. | |
| constexpr bool | operator> (const TimeSpan &other) const |
| Compares elapsed durations, ignoring start time. | |
| constexpr bool | operator>= (const TimeSpan &other) const |
| Compares elapsed durations, ignoring start time. | |
| constexpr void | setElapsedHours (fltp08 elapsed_minutes) |
| Sets the elapsed duration in hours. | |
| constexpr void | setElapsedMinutes (fltp08 elapsed_minutes) |
| Sets the elapsed duration in minutes. | |
| constexpr void | setElapsedSeconds (fltp08 elapsed_seconds) |
| Sets the elapsed duration in seconds. | |
| constexpr void | setEndTime (Time time) |
| Sets the end time by recomputing the elapsed duration from the current start time. | |
| constexpr void | setStartTime (Time time) |
| Sets the start time of this span without modifying the elapsed duration. | |
| constexpr Time | startTime () const |
| Returns the start time of this span. | |
Protected Attributes | |
| sint08 | m_elapsed_time |
| The elapsed duration in nanoseconds. Can be negative for past spans. | |
| Time | m_start_time |
| The optional start time of this span. Invalid if not set. | |
Stores a time span, or difference between two times, with an optional start time.
Note: timespans can be negative to represent times in the past from an optional start time or positive to represent a time in the future from a given start time.
Definition at line 45 of file TimeSpan.h.
|
inlineexplicitconstexpr |
Constructs a TimeSpan from a signed 32-bit nanosecond duration with no start time.
| [in] | elapsed_nano_seconds | The elapsed time in nanoseconds. |
Definition at line 59 of file TimeSpan.h.
References m_elapsed_time, and m_start_time.
|
inlineexplicitconstexpr |
Constructs a TimeSpan from a signed 64-bit nanosecond duration with no start time.
| [in] | elapsed_nano_seconds | The elapsed time in nanoseconds. |
Definition at line 67 of file TimeSpan.h.
References m_elapsed_time, and m_start_time.
|
inlineexplicitconstexpr |
Constructs a TimeSpan from an unsigned 32-bit nanosecond duration with no start time.
| [in] | elapsed_nano_seconds | The elapsed time in nanoseconds. |
Definition at line 75 of file TimeSpan.h.
References cast(), m_elapsed_time, and m_start_time.
|
inlineexplicitconstexpr |
Constructs a TimeSpan from an unsigned 64-bit nanosecond duration with no start time.
| [in] | elapsed_nano_seconds | The elapsed time in nanoseconds. |
Definition at line 83 of file TimeSpan.h.
References cast(), m_elapsed_time, and m_start_time.
|
inlineexplicitconstexpr |
Constructs a TimeSpan from a duration in seconds with no start time.
| [in] | elapsed_seconds | The elapsed time in seconds. |
Definition at line 91 of file TimeSpan.h.
References cast(), m_elapsed_time, and m_start_time.
Constructs a TimeSpan from a start and end time, computing the elapsed duration.
| [in] | start | The start time. |
| [in] | end | The end time. |
Definition at line 100 of file TimeSpan.h.
References cast(), m_elapsed_time, and m_start_time.
Constructs a TimeSpan from a start time and an elapsed nanosecond duration.
| [in] | start | The start time. |
| [in] | elapsed_nano_seconds | The elapsed time in nanoseconds. |
Definition at line 110 of file TimeSpan.h.
References m_elapsed_time, and m_start_time.
Constructs a TimeSpan from a start time and an elapsed duration in seconds.
| [in] | start | The start time. |
| [in] | elapsed_seconds | The elapsed time in seconds. |
Definition at line 120 of file TimeSpan.h.
References cast(), m_elapsed_time, and m_start_time.
| bool TimeSpan::contains | ( | const Time & | time | ) | const |
Checks whether the given time falls within this time span.
| [in] | time | The time to test. |
| sint08 TimeSpan::elapsedDays | ( | ) | const |
Returns the elapsed duration in whole days, accounting for calendar boundaries.
|
inlinenodiscardconstexpr |
Returns the elapsed duration in hours.
Definition at line 246 of file TimeSpan.h.
References cast(), IsInvalid(), and m_elapsed_time.
|
inlinenodiscardconstexpr |
Returns the elapsed duration in milliseconds.
Definition at line 225 of file TimeSpan.h.
References cast(), IsInvalid(), and m_elapsed_time.
|
inlinenodiscardconstexpr |
Returns the elapsed duration in minutes.
Definition at line 236 of file TimeSpan.h.
References cast(), IsInvalid(), and m_elapsed_time.
| sint08 TimeSpan::elapsedMonths | ( | ) | const |
Returns the elapsed duration in whole months, accounting for calendar boundaries.
|
inlinenodiscardconstexpr |
Returns the elapsed duration in nanoseconds.
Definition at line 204 of file TimeSpan.h.
References m_elapsed_time.
Referenced by operator%().
Computes the percentage of elapsed time at a given point within this span.
| [in] | time | The time to evaluate. |
| [in] | clip_time | Whether to clamp the result to the [0, 1] range. |
|
inlinenodiscardconstexpr |
Returns the elapsed duration in seconds.
Definition at line 213 of file TimeSpan.h.
References cast(), IsInvalid(), and m_elapsed_time.
Referenced by HardwareCommandQueue< t_type >::getCommandCSVInfo(), HardwareCommandQueue< t_type >::getCommandJSONInfo(), RealSenseMotor::update(), and LineEditResourceSetter< TimeSpan, ObjectInfo< TimeSpan >::Number >::ValueToFloat().
|
nodiscard |
Computes the end time by adding the elapsed duration to the start time.
| String TimeSpan::getTimeString | ( | const StringView & | format_string | ) | const |
Formats the time span as a human-readable string using the given format.
| [in] | format_string | The format pattern to use for string conversion. |
|
inlineconstexpr |
Checks inequality of start time or elapsed duration.
| [in] | time | The other TimeSpan to compare against. |
Definition at line 277 of file TimeSpan.h.
References TimeSpan(), m_elapsed_time, and m_start_time.
Multiplies the elapsed duration by a floating-point factor.
| [in] | mult | The floating-point multiplier. |
Definition at line 361 of file TimeSpan.h.
References TimeSpan(), cast(), m_elapsed_time, and m_start_time.
Multiplies the elapsed duration by an integer factor.
| [in] | mult | The integer multiplier. |
Definition at line 352 of file TimeSpan.h.
References TimeSpan(), m_elapsed_time, and m_start_time.
Multiplies the elapsed duration in place by a floating-point factor.
| [in] | mult | The floating-point multiplier. |
Definition at line 380 of file TimeSpan.h.
References TimeSpan(), cast(), and m_elapsed_time.
Multiplies the elapsed duration in place by an integer factor.
| [in] | mult | The integer multiplier. |
Definition at line 370 of file TimeSpan.h.
References TimeSpan(), cast(), and m_elapsed_time.
Adds two time spans, combining their elapsed durations.
| [in] | other | The TimeSpan to add. |
Definition at line 390 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
Adds another span's elapsed duration to this one in place.
| [in] | other | The TimeSpan to add. |
Definition at line 399 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
|
inlineconstexpr |
Negates the elapsed duration of this time span.
Definition at line 417 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
Subtracts another span's elapsed duration from this one.
| [in] | other | The TimeSpan to subtract. |
Definition at line 409 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
Subtracts another span's elapsed duration from this one in place.
| [in] | other | The TimeSpan to subtract. |
Definition at line 426 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
Divides the elapsed duration by a floating-point denominator.
| [in] | den | The floating-point divisor. |
Definition at line 342 of file TimeSpan.h.
References TimeSpan(), cast(), m_elapsed_time, and m_start_time.
Divides the elapsed duration by an integer denominator.
| [in] | den | The integer divisor. |
Definition at line 333 of file TimeSpan.h.
References TimeSpan(), m_elapsed_time, and m_start_time.
Divides this span by another, returning the ratio of elapsed durations.
| [in] | time_2 | The divisor TimeSpan. |
Definition at line 324 of file TimeSpan.h.
References TimeSpan(), cast(), and m_elapsed_time.
|
inlineconstexpr |
Compares elapsed durations, ignoring start time.
| [in] | other | The other TimeSpan to compare against. |
Definition at line 305 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
|
inlineconstexpr |
Compares elapsed durations, ignoring start time.
| [in] | other | The other TimeSpan to compare against. |
Definition at line 314 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
|
inlineconstexpr |
Checks equality of both start time and elapsed duration.
| [in] | time | The other TimeSpan to compare against. |
Definition at line 267 of file TimeSpan.h.
References TimeSpan(), m_elapsed_time, and m_start_time.
|
inlineconstexpr |
Compares elapsed durations, ignoring start time.
| [in] | other | The other TimeSpan to compare against. |
Definition at line 287 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
|
inlineconstexpr |
Compares elapsed durations, ignoring start time.
| [in] | other | The other TimeSpan to compare against. |
Definition at line 296 of file TimeSpan.h.
References TimeSpan(), and m_elapsed_time.
|
inlineconstexpr |
Sets the elapsed duration in hours.
| [in] | elapsed_minutes | The new elapsed duration in hours. |
Definition at line 183 of file TimeSpan.h.
References cast(), and m_elapsed_time.
|
inlineconstexpr |
Sets the elapsed duration in minutes.
| [in] | elapsed_minutes | The new elapsed duration in minutes. |
Definition at line 175 of file TimeSpan.h.
References cast(), and m_elapsed_time.
|
inlineconstexpr |
Sets the elapsed duration in seconds.
| [in] | elapsed_seconds | The new elapsed duration in seconds. |
Definition at line 167 of file TimeSpan.h.
References cast(), and m_elapsed_time.
|
inlineconstexpr |
Sets the end time by recomputing the elapsed duration from the current start time.
| [in] | time | The new end time. |
Definition at line 159 of file TimeSpan.h.
References Time::getNanoSeconds(), m_elapsed_time, and m_start_time.
|
inlineconstexpr |
Sets the start time of this span without modifying the elapsed duration.
| [in] | time | The new start time. |
Definition at line 151 of file TimeSpan.h.
References m_start_time.
|
inlinenodiscardconstexpr |
Returns the start time of this span.
Definition at line 143 of file TimeSpan.h.
References m_start_time.