RTI Connext C# API  6.1.0
Duration Struct Reference

Represents a time duration. More...

Inherits IEquatable< Duration >, and IComparable< Duration >.

Public Member Functions

 Duration (int sec, uint nsec=0)
 Creates a new object with the specified absolute number of seconds and nanoseconds. More...
 
int CompareTo (Duration other)
 Compares two durations. More...
 
bool Equals (Duration other)
 Compares two durations for equality. More...
 
override bool Equals (object obj)
 Compares two objects for equality. More...
 
override int GetHashCode ()
 Gets the hash code. More...
 
override string ToString ()
 Converts this object to a string. More...
 

Static Public Member Functions

static Duration FromSeconds (uint seconds)
 Creates a duration from the specified total number of seconds. More...
 
static Duration FromSeconds (double seconds)
 Creates a duration from the specified total number of seconds. More...
 
static Duration FromMilliseconds (ulong ms)
 Creates a duration from the specified total number of milliseconds. More...
 
static bool operator== (in Duration a, in Duration b)
 Compares for equality. More...
 
static bool operator!= (in Duration a, in Duration b)
 Compares for inequality. More...
 
static bool operator< (in Duration a, in Duration b)
 Determines if one duration is smaller than another duration. More...
 
static bool operator> (in Duration a, in Duration b)
 Determines if one duration is greater than another duration. More...
 
static bool operator<= (in Duration a, in Duration b)
 Determines if one duration is smaller or equal than another duration. More...
 
static bool operator>= (in Duration a, in Duration b)
 Determines if one duration is larger or equal than another duration. More...
 
static operator TimeSpan (Duration d)
 Explicit conversion from Duration to TimeSpan. Loss of precision is possible, since a TimeSpan has a smaller resolution. More...
 
static operator Duration (TimeSpan t)
 Explicit conversion from TimeSpan to Duration. More...
 

Static Public Attributes

const uint NanosecondsPerSecond
 Constant defining how many nanoseconds are in a second More...
 
const uint NanosecondsPerMillisecond
 Constant defining how many nanoseconds are in a millisecond More...
 
const uint MillisecondsPerSecond
 Constant defining how many milliseconds are in a second More...
 

Properties

static Duration Zero [get]
 Object representing a zero duration. More...
 
static Duration Infinite [get]
 Object representing an Infinite duration More...
 
static Duration Auto [get]
 Object indicating that the duration should be automatically determined. More...
 
int Seconds [get]
 Gets the second component of this object. More...
 
uint Nanoseconds [get]
 Gets the nanosecond component of this object. More...
 
ulong TotalMilliseconds [get]
 Gets the total number of milliseconds More...
 

Detailed Description

Represents a time duration.

Constructor & Destructor Documentation

◆ Duration()

Duration ( int  sec,
uint  nsec = 0 
)

Creates a new object with the specified absolute number of seconds and nanoseconds.

Member Function Documentation

◆ CompareTo()

int CompareTo ( Duration  other)

Compares two durations.

◆ Equals() [1/2]

bool Equals ( Duration  other)

Compares two durations for equality.

◆ Equals() [2/2]

override bool Equals ( object  obj)

Compares two objects for equality.

◆ FromMilliseconds()

static Duration FromMilliseconds ( ulong  ms)
static

Creates a duration from the specified total number of milliseconds.

◆ FromSeconds() [1/2]

static Duration FromSeconds ( double  seconds)
static

Creates a duration from the specified total number of seconds.

◆ FromSeconds() [2/2]

static Duration FromSeconds ( uint  seconds)
static

Creates a duration from the specified total number of seconds.

◆ GetHashCode()

override int GetHashCode ( )

Gets the hash code.

◆ operator Duration()

static operator Duration ( TimeSpan  t)
explicitstatic

Explicit conversion from TimeSpan to Duration.

◆ operator TimeSpan()

static operator TimeSpan ( Duration  d)
explicitstatic

Explicit conversion from Duration to TimeSpan. Loss of precision is possible, since a TimeSpan has a smaller resolution.

◆ operator!=()

static bool operator!= ( in Duration  a,
in Duration  b 
)
static

Compares for inequality.

◆ operator<()

static bool operator< ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is smaller than another duration.

◆ operator<=()

static bool operator<= ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is smaller or equal than another duration.

◆ operator==()

static bool operator== ( in Duration  a,
in Duration  b 
)
static

Compares for equality.

◆ operator>()

static bool operator> ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is greater than another duration.

◆ operator>=()

static bool operator>= ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is larger or equal than another duration.

◆ ToString()

override string ToString ( )

Converts this object to a string.

Member Data Documentation

◆ MillisecondsPerSecond

const uint MillisecondsPerSecond
static

Constant defining how many milliseconds are in a second

◆ NanosecondsPerMillisecond

const uint NanosecondsPerMillisecond
static

Constant defining how many nanoseconds are in a millisecond

◆ NanosecondsPerSecond

const uint NanosecondsPerSecond
static

Constant defining how many nanoseconds are in a second

Property Documentation

◆ Auto

Duration Auto
staticget

Object indicating that the duration should be automatically determined.

◆ Infinite

Duration Infinite
staticget

Object representing an Infinite duration

◆ Nanoseconds

uint Nanoseconds
get

Gets the nanosecond component of this object.

◆ Seconds

int Seconds
get

Gets the second component of this object.

◆ TotalMilliseconds

ulong TotalMilliseconds
get

Gets the total number of milliseconds

◆ Zero

Duration Zero
staticget

Object representing a zero duration.