RTI Connext C# API Version 7.3.0
Omg.Dds.Core.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 Duration operator- (in Duration a, in Duration b)
 Substracts two durations. More...
 
static Duration operator+ (in Duration a, in Duration b)
 Adds two durations. 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 = 1_000_000_000
 Constant defining how many nanoseconds are in a second More...
 
const uint NanosecondsPerMillisecond = 1_000_000
 Constant defining how many nanoseconds are in a millisecond More...
 
const uint MillisecondsPerSecond = 1_000
 Constant defining how many milliseconds are in a second More...
 

Properties

static Duration Zero = new Duration(0, 0) [get]
 Object representing a zero duration. More...
 
static Duration Infinite [get]
 Object representing an Infinite duration More...
 
static Duration Auto = new Duration(-1, 0) [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()

Omg.Dds.Core.Duration.Duration ( int  sec,
uint  nsec = 0 
)

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

Member Function Documentation

◆ FromSeconds() [1/2]

static Duration Omg.Dds.Core.Duration.FromSeconds ( uint  seconds)
static

Creates a duration from the specified total number of seconds.

◆ FromSeconds() [2/2]

static Duration Omg.Dds.Core.Duration.FromSeconds ( double  seconds)
static

Creates a duration from the specified total number of seconds.

◆ FromMilliseconds()

static Duration Omg.Dds.Core.Duration.FromMilliseconds ( ulong  ms)
static

Creates a duration from the specified total number of milliseconds.

◆ CompareTo()

int Omg.Dds.Core.Duration.CompareTo ( Duration  other)

Compares two durations.

◆ Equals() [1/2]

bool Omg.Dds.Core.Duration.Equals ( Duration  other)

Compares two durations for equality.

◆ Equals() [2/2]

override bool Omg.Dds.Core.Duration.Equals ( object  obj)

Compares two objects for equality.

◆ GetHashCode()

override int Omg.Dds.Core.Duration.GetHashCode ( )

Gets the hash code.

◆ ToString()

override string Omg.Dds.Core.Duration.ToString ( )

Converts this object to a string.

◆ operator==()

static bool Omg.Dds.Core.Duration.operator== ( in Duration  a,
in Duration  b 
)
static

Compares for equality.

◆ operator!=()

static bool Omg.Dds.Core.Duration.operator!= ( in Duration  a,
in Duration  b 
)
static

Compares for inequality.

◆ operator<()

static bool Omg.Dds.Core.Duration.operator< ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is smaller than another duration.

◆ operator>()

static bool Omg.Dds.Core.Duration.operator> ( in Duration  a,
in Duration  b 
)
static

Determines if one duration is greater than another duration.

◆ operator<=()

static bool Omg.Dds.Core.Duration.operator<= ( in Duration  a,
in Duration  b 
)
static

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

◆ operator>=()

static bool Omg.Dds.Core.Duration.operator>= ( in Duration  a,
in Duration  b 
)
static

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

◆ operator-()

static Duration Omg.Dds.Core.Duration.operator- ( in Duration  a,
in Duration  b 
)
inlinestatic

Substracts two durations.

◆ operator+()

static Duration Omg.Dds.Core.Duration.operator+ ( in Duration  a,
in Duration  b 
)
inlinestatic

Adds two durations.

◆ operator TimeSpan()

static Omg.Dds.Core.Duration.operator TimeSpan ( Duration  d)
explicitstatic

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

◆ operator Duration()

static Omg.Dds.Core.Duration.operator Duration ( TimeSpan  t)
explicitstatic

Explicit conversion from TimeSpan to Duration.

Field Documentation

◆ NanosecondsPerSecond

const uint Omg.Dds.Core.Duration.NanosecondsPerSecond = 1_000_000_000
static

Constant defining how many nanoseconds are in a second

◆ NanosecondsPerMillisecond

const uint Omg.Dds.Core.Duration.NanosecondsPerMillisecond = 1_000_000
static

Constant defining how many nanoseconds are in a millisecond

◆ MillisecondsPerSecond

const uint Omg.Dds.Core.Duration.MillisecondsPerSecond = 1_000
static

Constant defining how many milliseconds are in a second

Property Documentation

◆ Zero

Duration Omg.Dds.Core.Duration.Zero = new Duration(0, 0)
staticget

Object representing a zero duration.

◆ Infinite

Duration Omg.Dds.Core.Duration.Infinite
staticget
Initial value:
= new Duration(
0x7fffffff,
0xffffffff)
Duration(int sec, uint nsec=0)
Creates a new object with the specified absolute number of seconds and nanoseconds.

Object representing an Infinite duration

◆ Auto

Duration Omg.Dds.Core.Duration.Auto = new Duration(-1, 0)
staticget

Object indicating that the duration should be automatically determined.

◆ Seconds

int Omg.Dds.Core.Duration.Seconds
get

Gets the second component of this object.

◆ Nanoseconds

uint Omg.Dds.Core.Duration.Nanoseconds
get

Gets the nanosecond component of this object.

◆ TotalMilliseconds

ulong Omg.Dds.Core.Duration.TotalMilliseconds
get

Gets the total number of milliseconds