RTI Connext Java API  Version 6.1.1

Type for duration representation. More...

Inherits Struct, and Externalizable.

Public Member Functions

 Duration_t (Duration_t duration)
 Copy constructor. More...
 
 Duration_t (int sec, int nanosec)
 
boolean is_zero ()
 
boolean is_infinite ()
 
boolean is_auto ()
 
Duration_t add (Duration_t other)
 
Duration_t subtract (Duration_t other)
 

Static Public Member Functions

static Duration_t from_micros (long micros)
 Creates a new duration object from a duration expressed in microseconds. More...
 
static Duration_t from_nanos (long nanos)
 Creates a new duration object from a duration expressed in nanoseconds. More...
 
static Duration_t from_millis (long millis)
 Creates a new duration object from a duration expressed in milliseconds. More...
 
static Duration_t from_seconds (int seconds)
 Creates a new duration object from a duration expressed in seconds. More...
 

Public Attributes

int sec
 seconds More...
 
int nanosec
 nanoseconds More...
 

Static Public Attributes

static final int DURATION_ZERO_SEC
 A zero-length second period of time. More...
 
static final int DURATION_ZERO_NSEC
 A zero-length nano-second period of time. More...
 
static final int DURATION_INFINITE_SEC
 An infinite second period of time. More...
 
static final int DURATION_INFINITE_NSEC
 An infinite nano-second period of time. More...
 
static final int DURATION_AUTO_SEC
 An auto second period of time. More...
 
static final int DURATION_AUTO_NSEC
 An auto nano-second period of time. More...
 
static final Duration_t DURATION_ZERO
 A zero-length period of time. More...
 
static final Duration_t DURATION_INFINITE
 An infinite period of time. More...
 
static final Duration_t DURATION_AUTO
 Duration is automatically assigned. More...
 

Detailed Description

Type for duration representation.

Represents a time interval.

Constructor & Destructor Documentation

◆ Duration_t() [1/2]

Duration_t ( Duration_t  duration)

Copy constructor.

Parameters
durationThe duration instance to copy. It must not be null.

References Duration_t.nanosec, and Duration_t.sec.

◆ Duration_t() [2/2]

Duration_t ( int  sec,
int  nanosec 
)
Parameters
secmust be >=0
nanosecmust be >=0 and < 1000000000

References Duration_t.nanosec, and Duration_t.sec.

Member Function Documentation

◆ from_micros()

static Duration_t from_micros ( long  micros)
static

Creates a new duration object from a duration expressed in microseconds.

In case of an overflow this function returns com.rti.dds.infrastructure.Duration_t.DURATION_INFINITE.

References Duration_t.DURATION_INFINITE.

◆ from_nanos()

static Duration_t from_nanos ( long  nanos)
static

Creates a new duration object from a duration expressed in nanoseconds.

In case of an overflow this function returns com.rti.dds.infrastructure.Duration_t.DURATION_INFINITE.

References Duration_t.DURATION_INFINITE.

◆ from_millis()

static Duration_t from_millis ( long  millis)
static

Creates a new duration object from a duration expressed in milliseconds.

In case of an overflow this function returns com.rti.dds.infrastructure.Duration_t.DURATION_INFINITE.

References Duration_t.DURATION_INFINITE.

◆ from_seconds()

static Duration_t from_seconds ( int  seconds)
static

Creates a new duration object from a duration expressed in seconds.

References Duration_t.nanosec, and Duration_t.sec.

◆ is_zero()

boolean is_zero ( )
Returns
com.rti.dds.infrastructure.true if the given duration is of zero length.

◆ is_infinite()

boolean is_infinite ( )
Returns
com.rti.dds.infrastructure.true if the given duration is of infinite length.

Referenced by Duration_t.add(), and Duration_t.subtract().

◆ is_auto()

boolean is_auto ( )
Returns
com.rti.dds.infrastructure.true if the given duration has auto value.

◆ add()

Duration_t add ( Duration_t  other)

Calculates a duration as the result of adding other and this.

Special case:

References Duration_t.DURATION_INFINITE, Duration_t.is_infinite(), Duration_t.nanosec, and Duration_t.sec.

◆ subtract()

Duration_t subtract ( Duration_t  other)

Calculates a duration as the result of substracting other to this.

Special cases:

References Duration_t.DURATION_ZERO, Duration_t.is_infinite(), Duration_t.nanosec, and Duration_t.sec.

Member Data Documentation

◆ DURATION_ZERO_SEC

final int DURATION_ZERO_SEC
static

A zero-length second period of time.

◆ DURATION_ZERO_NSEC

final int DURATION_ZERO_NSEC
static

A zero-length nano-second period of time.

◆ DURATION_INFINITE_SEC

final int DURATION_INFINITE_SEC
static

An infinite second period of time.

◆ DURATION_INFINITE_NSEC

final int DURATION_INFINITE_NSEC
static

An infinite nano-second period of time.

◆ DURATION_AUTO_SEC

final int DURATION_AUTO_SEC
static

An auto second period of time.

◆ DURATION_AUTO_NSEC

final int DURATION_AUTO_NSEC
static

An auto nano-second period of time.

◆ DURATION_ZERO

final Duration_t DURATION_ZERO
static

A zero-length period of time.

Referenced by Duration_t.subtract().

◆ DURATION_INFINITE

final Duration_t DURATION_INFINITE
static

◆ DURATION_AUTO

final Duration_t DURATION_AUTO
static

Duration is automatically assigned.

◆ sec

◆ nanosec

int nanosec