RTI Connext C# API  6.1.0
Time Struct Reference

Represents a moment in time. More...

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

Public Member Functions

 Time (int sec, uint nsec=0)
 Creates a new object with the specified absolute number of seconds and nanoseconds. More...
 
int CompareTo (Time other)
 Compares two times. More...
 
bool Equals (Time other)
 Compares two times 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 Time FromSeconds (uint seconds)
 Creates a time from the specified total number of seconds. More...
 
static Time FromSeconds (double seconds)
 Creates a time from the specified total number of seconds. More...
 
static Time FromMilliseconds (ulong ms)
 Creates a time from the specified total number of milliseconds. More...
 
static bool operator== (in Time a, in Time b)
 Compares for equality. More...
 
static bool operator!= (in Time a, in Time b)
 Compares for inequality. More...
 
static bool operator< (in Time a, in Time b)
 Determines if one time value is smaller than another one. More...
 
static bool operator> (in Time a, in Time b)
 Determines if one time value is greater than another one. More...
 
static bool operator<= (in Time a, in Time b)
 Determines if one time value is smaller or equal than another one. More...
 
static bool operator>= (in Time a, in Time b)
 Determines if one time value is greater or equal than another one. More...
 

Static Public Attributes

const uint NanosecondsPerSecond
 Number of nanoseconds in a second More...
 
const uint NanosecondsPerMillisecond
 Number of nanoseconds in a millisecond More...
 
const uint MillisecondsPerSecond
 Number of milliseconds in a second More...
 

Properties

static Time Zero [get]
 The default instant in time: zero seconds and zero nanoseconds More...
 
static Time MaxValue [get]
 The maximum valid value of Time More...
 
static Time Invalid [get]
 A special sentinel that indicates an invalid or unknown time. 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 moment in time.

Constructor & Destructor Documentation

◆ Time()

Time ( int  sec,
uint  nsec = 0 
)

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

Member Function Documentation

◆ CompareTo()

int CompareTo ( Time  other)

Compares two times.

◆ Equals() [1/2]

override bool Equals ( object  obj)

Compares two objects for equality.

◆ Equals() [2/2]

bool Equals ( Time  other)

Compares two times for equality.

◆ FromMilliseconds()

static Time FromMilliseconds ( ulong  ms)
static

Creates a time from the specified total number of milliseconds.

◆ FromSeconds() [1/2]

static Time FromSeconds ( double  seconds)
static

Creates a time from the specified total number of seconds.

◆ FromSeconds() [2/2]

static Time FromSeconds ( uint  seconds)
static

Creates a time from the specified total number of seconds.

◆ GetHashCode()

override int GetHashCode ( )

Gets the hash code.

◆ operator!=()

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

Compares for inequality.

◆ operator<()

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

Determines if one time value is smaller than another one.

◆ operator<=()

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

Determines if one time value is smaller or equal than another one.

◆ operator==()

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

Compares for equality.

◆ operator>()

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

Determines if one time value is greater than another one.

◆ operator>=()

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

Determines if one time value is greater or equal than another one.

◆ ToString()

override string ToString ( )

Converts this object to a string.

Member Data Documentation

◆ MillisecondsPerSecond

const uint MillisecondsPerSecond
static

Number of milliseconds in a second

◆ NanosecondsPerMillisecond

const uint NanosecondsPerMillisecond
static

Number of nanoseconds in a millisecond

◆ NanosecondsPerSecond

const uint NanosecondsPerSecond
static

Number of nanoseconds in a second

Property Documentation

◆ Invalid

Time Invalid
staticget

A special sentinel that indicates an invalid or unknown time.

◆ MaxValue

Time MaxValue
staticget

The maximum valid value of Time

◆ 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

Time Zero
staticget

The default instant in time: zero seconds and zero nanoseconds

The full documentation is available in the C API: DDS_TIME_ZERO