TDuration
A duration with nanosecond precision
Definition
Unit: Neslib.Iceoryx2.Types
Constants
| Name | Description |
|---|---|
| HOURS_PER_DAY | |
| MICROSECS_PER_SEC | |
| MILLISECS_PER_SEC | |
| NANOSECS_PER_MICROSEC | |
| NANOSECS_PER_MILLISEC | |
| NANOSECS_PER_SEC | |
| SECS_PER_DAY | |
| SECS_PER_HOUR | |
| SECS_PER_MINUTE |
Constructors
| Name | Description |
|---|---|
| Create | Constructs a new TDuration from seconds and nanoseconds. |
Operators
| Name | Description |
|---|---|
| Add | Returns ALeft + ARight, or TDuration.Max on overflow. |
| Equal | Returns whether ALeft = ARight |
| GreaterThan | Returns whether ALeft > ARight |
| GreaterThanOrEqual | Returns whether ALeft >= ARight |
| LessThan | Returns whether ALeft |
| LessThanOrEqual | Returns whether ALeft |
| NotEqual | Returns whether ALeft |
| Subtract | Returns ALeft - ARight, or TDuration.Zero on overflow. |
Methods
| Name | Description |
|---|---|
| AsDays | Returns the duration in days. |
| AsHours | Returns the duration in hours. |
| AsMicros | Returns the duration in microseconds. |
| AsMillis | Returns the duration in milliseconds. |
| AsMins | Returns the duration in minutes. |
| AsNanos | Returns the duration in nanoseconds. |
| AsSecs | Returns the duration in seconds. |
| FromDays | Constructs a new TDuration from days. |
| FromHours | Constructs a new TDuration from hours. |
| FromMicros | Constructs a new TDuration from microseconds. |
| FromMillis | Constructs a new TDuration from milliseconds. |
| FromMins | Constructs a new TDuration from minutes. |
| FromNanos | Constructs a new TDuration from nanoseconds. |
| FromSecs | Constructs a new TDuration from seconds. |
| Init | Constructs a new TDuration from seconds and nanoseconds. |
| Max | Constructs a new TDuration of maximum allowed length. Useful for functions which should have an "infinite" timeout. |
| SubsecMicros | Returns the subsecond part of the duration in microseconds |
| SubsecMillis | Returns the subsecond part of the duration in milliseconds |
| SubsecNanos | Returns the subsecond part of the duration in nanoseconds |
| ToDateTime | Converts duration to a Delphi TDateTime. |
| ToString | Converts duration to a string in '0s 0ns' format. |
| Zero | Constructs a new TDuration with a duration of zero |
Constant Descriptions
HOURS_PER_DAY
const HOURS_PER_DAY = 24
MICROSECS_PER_SEC
const MICROSECS_PER_SEC = MILLISECS_PER_SEC * 1000
MILLISECS_PER_SEC
const MILLISECS_PER_SEC = 1000
NANOSECS_PER_MICROSEC
const NANOSECS_PER_MICROSEC = 1000
NANOSECS_PER_MILLISEC
const NANOSECS_PER_MILLISEC = NANOSECS_PER_MICROSEC * 1000
NANOSECS_PER_SEC
const NANOSECS_PER_SEC = NANOSECS_PER_MILLISEC * 1000
SECS_PER_DAY
const SECS_PER_DAY = HOURS_PER_DAY * SECS_PER_HOUR
SECS_PER_HOUR
const SECS_PER_HOUR = 3600
SECS_PER_MINUTE
const SECS_PER_MINUTE = 60
Constructor Descriptions
Create
Constructs a new TDuration from seconds and nanoseconds.
constructor Create(const ASeconds: UInt64; const ANanoseconds: UInt32)
Parameters
ASeconds: UInt64
: Seconds portion of the duration.
ANanoseconds: UInt32
: Nanoseconds portion of the duration.
Operator Descriptions
Add(TDuration, TDuration)
Returns ALeft + ARight, or TDuration.Max on overflow.
class operator Add(const ALeft, ARight: TDuration): TDuration; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Equal(TDuration, TDuration)
Returns whether ALeft = ARight
class operator Equal(const ALeft, ARight: TDuration): Boolean; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
GreaterThan(TDuration, TDuration)
Returns whether ALeft > ARight
class operator GreaterThan(const ALeft, ARight: TDuration): Boolean; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
GreaterThanOrEqual(TDuration, TDuration)
Returns whether ALeft >= ARight
class operator GreaterThanOrEqual(const ALeft, ARight: TDuration): Boolean; inline; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
LessThan(TDuration, TDuration)
Returns whether ALeft
class operator LessThan(const ALeft, ARight: TDuration): Boolean; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
LessThanOrEqual(TDuration, TDuration)
Returns whether ALeft
class operator LessThanOrEqual(const ALeft, ARight: TDuration): Boolean; inline; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
NotEqual(TDuration, TDuration)
Returns whether ALeft <>ARight
class operator NotEqual(const ALeft, ARight: TDuration): Boolean; inline; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Boolean
Subtract(TDuration, TDuration)
Returns ALeft - ARight, or TDuration.Zero on overflow.
class operator Subtract(const ALeft, ARight: TDuration): TDuration; static
Parameters
ALeft: TDuration
ARight: TDuration
Returns
Method Descriptions
AsDays
Returns the duration in days.
function AsDays: UInt64; inline
Returns
UInt64
Remarks
The remaining hours are truncated, similar to the casting behavior of a Single to an Integer.
AsHours
Returns the duration in hours.
function AsHours: UInt64; inline
Returns
UInt64
Remarks
The remaining minutes are truncated, similar to the casting behavior of a Single to an Integer.
AsMicros
Returns the duration in microseconds.
function AsMicros: UInt64
Returns
UInt64
Remarks
If the duration in microseconds is larger than an UInt64 can represent, it will be clamped to the UInt64.MaxValue
The remaining nanoseconds are truncated, similar to the casting behavior of a Single to an Integer.
AsMillis
Returns the duration in milliseconds.
function AsMillis: UInt64
Returns
UInt64
Remarks
If the duration in milliseconds is larger than an UInt64 can represent, it will be clamped to the UInt64.MaxValue
The remaining microseconds are truncated, similar to the casting behavior of a Single to an Integer.
AsMins
Returns the duration in minutes.
function AsMins: UInt64; inline
Returns
UInt64
Remarks
The remaining seconds are truncated, similar to the casting behavior of a Single to an Integer.
AsNanos
Returns the duration in nanoseconds.
function AsNanos: UInt64
Returns
UInt64
Remarks
If the duration in nanoseconds is larger than an UInt64 can represent, it will be clamped to the UInt64.MaxValue
AsSecs
Returns the duration in seconds.
function AsSecs: UInt64; inline
Returns
UInt64
Remarks
The remaining milliseconds are truncated, similar to the casting behavior of a Single to an Integer.
FromDays(UInt64)
Constructs a new TDuration from days.
class function FromDays(const AValue: UInt64): TDuration; inline; static
Parameters
AValue: UInt64
: Value as days.
Returns
FromHours(UInt64)
Constructs a new TDuration from hours.
class function FromHours(const AValue: UInt64): TDuration; inline; static
Parameters
AValue: UInt64
: Value as hours.
Returns
FromMicros(UInt64)
Constructs a new TDuration from microseconds.
class function FromMicros(const AValue: UInt64): TDuration; static
Parameters
AValue: UInt64
: Value as microseconds.
Returns
FromMillis(UInt64)
Constructs a new TDuration from milliseconds.
class function FromMillis(const AValue: UInt64): TDuration; static
Parameters
AValue: UInt64
: Value as milliseconds.
Returns
FromMins(UInt64)
Constructs a new TDuration from minutes.
class function FromMins(const AValue: UInt64): TDuration; inline; static
Parameters
AValue: UInt64
: Value as minutes.
Returns
FromNanos(UInt64)
Constructs a new TDuration from nanoseconds.
class function FromNanos(const AValue: UInt64): TDuration; static
Parameters
AValue: UInt64
: Value as nanoseconds.
Returns
FromSecs(UInt64)
Constructs a new TDuration from seconds.
class function FromSecs(const AValue: UInt64): TDuration; inline; static
Parameters
AValue: UInt64
: Value as seconds.
Returns
Init(UInt64, UInt32)
Constructs a new TDuration from seconds and nanoseconds.
procedure Init(const ASeconds: UInt64; const ANanoseconds: UInt32); inline
Parameters
ASeconds: UInt64
: Seconds portion of the duration.
ANanoseconds: UInt32
: Nanoseconds portion of the duration.
Max
Constructs a new TDuration of maximum allowed length. Useful for functions which should have an "infinite" timeout.
class function Max: TDuration; inline; static
Returns
SubsecMicros
Returns the subsecond part of the duration in microseconds
function SubsecMicros: UInt32; inline
Returns
UInt32
Remarks
The remaining nanoseconds are truncated, similar to the casting behavior of a Single to an Integer.
SubsecMillis
Returns the subsecond part of the duration in milliseconds
function SubsecMillis: UInt32; inline
Returns
UInt32
Remarks
The remaining microseconds are truncated, similar to the casting behavior of a Single to an Integer.
SubsecNanos
Returns the subsecond part of the duration in nanoseconds
function SubsecNanos: UInt32; inline
Returns
UInt32
ToDateTime
Converts duration to a Delphi TDateTime.
function ToDateTime: TDateTime; inline
Returns
TDateTime
ToString
Converts duration to a string in '0s 0ns' format.
function ToString: String; inline
Returns
String
Zero
Constructs a new TDuration with a duration of zero
class function Zero: TDuration; inline; static