OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.core.Time Class Referenceabstract

A moment in time expressed with nanosecond precision (though not necessarily nanosecond accuracy). More...

Inheritance diagram for org.omg.dds.core.Time:
Inheritance graph
Collaboration diagram for org.omg.dds.core.Time:
Collaboration graph

Public Member Functions

ServiceEnvironment getEnvironment ()
 
abstract long getRemainder (TimeUnit primaryUnit, TimeUnit remainderUnit)
 If getting the magnitude of this time in the given primaryUnit would cause truncation with respect to the given remainderUnit, return the magnitude of the truncation in the latter (presumably finer-grained) unit. More...
 
abstract long getTime (TimeUnit inThisUnit)
 Truncate this time to a whole-number quantity of the given time unit. More...
 
abstract boolean isValid ()
 
abstract ModifiableTime modifiableCopy ()
 

Static Public Member Functions

static Time invalidTime (ServiceEnvironment env)
 
static ModifiableTime newTime (long time, TimeUnit units, ServiceEnvironment env)
 Construct a specific instant in time. More...
 

Detailed Description

A moment in time expressed with nanosecond precision (though not necessarily nanosecond accuracy).

Definition at line 34 of file Time.java.

Member Function Documentation

◆ getEnvironment()

ServiceEnvironment org.omg.dds.core.DDSObject.getEnvironment ( )
inherited
Returns
the org.omg.dds.core.ServiceEnvironment object that directly or indirectly was used to create this object.

Implemented in org.omg.dds.core.ServiceEnvironment, org.opensplice.dds.sub.ReflectionDataReader< TYPE, OUT_TYPE >, org.opensplice.dds.core.ModifiableTimeImpl, org.opensplice.dds.pub.ReflectionDataWriter< TYPE >, org.opensplice.dds.core.DurationImpl, org.opensplice.dds.topic.ContentFilteredTopicImpl< TYPE >, org.opensplice.dds.sub.ReadConditionImpl< TYPE >, org.opensplice.dds.core.EntityQosImpl< T extends QosPolicy >, org.opensplice.dds.type.TypeSupportImpl< TYPE >, org.opensplice.dds.topic.PublicationBuiltinTopicDataImpl, org.opensplice.dds.topic.SubscriptionBuiltinTopicDataImpl, org.opensplice.dds.topic.TopicBuiltinTopicDataImpl, org.opensplice.dds.domain.DomainParticipantFactoryImpl, org.opensplice.dds.core.QosProviderImpl, org.opensplice.dds.core.status.OfferedIncompatibleQosStatusImpl, org.opensplice.dds.core.status.RequestedIncompatibleQosStatusImpl, org.opensplice.dds.core.InstanceHandleImpl, org.opensplice.dds.core.StatusConditionImpl< T extends Entity<?, ?>, org.opensplice.dds.core.status.LivelinessChangedStatusImpl, org.opensplice.dds.core.status.PublicationMatchedStatusImpl, org.opensplice.dds.core.status.SubscriptionMatchedStatusImpl, org.opensplice.dds.sub.SampleImpl< TYPE >, org.opensplice.dds.core.policy.ShareImpl, org.opensplice.dds.core.status.OfferedDeadlineMissedStatusImpl, org.opensplice.dds.core.status.SampleRejectedStatusImpl, org.opensplice.dds.core.WaitSetImpl, org.opensplice.dds.topic.ParticipantBuiltinTopicDataImpl, org.opensplice.dds.core.status.RequestedDeadlineMissedStatusImpl, org.opensplice.dds.topic.BuiltinTopicKeyImpl, org.opensplice.dds.core.GuardConditionImpl, org.opensplice.dds.core.event.AllDataDisposedEventImpl< TYPE >, org.opensplice.dds.core.policy.QosPolicyCountImpl, org.opensplice.dds.core.status.InconsistentTopicStatusImpl, org.opensplice.dds.core.status.LivelinessLostStatusImpl, org.opensplice.dds.core.status.SampleLostStatusImpl, org.opensplice.dds.core.policy.QosPolicyImpl, org.opensplice.dds.core.status.AllDataDisposedStatusImpl, org.opensplice.dds.core.IllegalArgumentExceptionImpl, org.opensplice.dds.core.InconsistentPolicyExceptionImpl, org.opensplice.dds.core.policy.PolicyFactoryImpl, org.opensplice.dds.core.policy.TypeConsistencyEnforcementImpl, org.opensplice.dds.core.PreconditionNotMetExceptionImpl, org.opensplice.dds.core.AlreadyClosedExceptionImpl, org.opensplice.dds.core.IllegalOperationExceptionImpl, org.opensplice.dds.core.ImmutablePolicyExceptionImpl, org.opensplice.dds.core.NotEnabledExceptionImpl, org.opensplice.dds.core.OutOfResourcesExceptionImpl, org.opensplice.dds.core.DDSExceptionImpl, org.opensplice.dds.core.status.DataAvailableStatusImpl, and org.opensplice.dds.core.status.DataOnReadersStatusImpl.

◆ getRemainder()

abstract long org.omg.dds.core.Time.getRemainder ( TimeUnit  primaryUnit,
TimeUnit  remainderUnit 
)
abstract

If getting the magnitude of this time in the given primaryUnit would cause truncation with respect to the given remainderUnit, return the magnitude of the truncation in the latter (presumably finer-grained) unit.

For example, if this time is equal to one second plus 100 nanoseconds since the start of the epoch, calling this method with arguments of TimeUnit#SECONDS and TimeUnit#NANOSECONDS respectively will result in the value 100.

This method is equivalent to the following pseudo-code:

(this - getTime(primaryUnit)).getTime(remainderUnit)

If remainderUnit is represents a coarser granularity than primaryUnit (for example, the former is TimeUnit#MILLISECONDS but the latter is TimeUnit#SECONDS), this method shall return 0.

If the resulting time cannot be expressed in the given units without overflowing, this method shall return Long#MAX_VALUE.

Parameters
primaryUnit
remainderUnitThe time unit in which the return result will be measured.
See also
getTime(TimeUnit)
Long::MAX_VALUE
TimeUnit

◆ getTime()

abstract long org.omg.dds.core.Time.getTime ( TimeUnit  inThisUnit)
abstract

Truncate this time to a whole-number quantity of the given time unit.

For example, if this time is equal to one second plus 100 nanoseconds since the start of the epoch, calling this method with an argument of TimeUnit#SECONDS will result in the value 1.

If this time is invalid, this method shall return a negative value, regardless of the units given.

If this time cannot be expressed in the given units without overflowing, this method shall return Long#MAX_VALUE. In such a case, the caller may wish to use this method in combination with getRemainder(TimeUnit, TimeUnit) to obtain the full time without lack of precision.

Parameters
inThisUnitThe time unit in which the return result will be measured.
See also
getRemainder(TimeUnit, TimeUnit)
Long::MAX_VALUE
TimeUnit

◆ invalidTime()

static Time org.omg.dds.core.Time.invalidTime ( ServiceEnvironment  env)
static
Parameters
envIdentifies the Service instance to which the object will belong.
Returns
An unmodifiable org.omg.dds.core.Time that is not valid.

Definition at line 81 of file Time.java.

◆ isValid()

abstract boolean org.omg.dds.core.Time.isValid ( )
abstract
Returns
whether this time represents a meaningful instant in time.

◆ modifiableCopy()

abstract ModifiableTime org.omg.dds.core.Time.modifiableCopy ( )
abstract
Returns
a modifiable copy of this object's state.

◆ newTime()

static ModifiableTime org.omg.dds.core.Time.newTime ( long  time,
TimeUnit  units,
ServiceEnvironment  env 
)
static

Construct a specific instant in time.

Negative values are considered invalid and will result in the construction of a time t such that:

t.isValid() == false

Parameters
envIdentifies the Service instance to which the new object will belong.
See also
isValid()

Definition at line 62 of file Time.java.


The documentation for this class was generated from the following file: