org.omg.dds.core
Class Time

java.lang.Object
  extended by org.omg.dds.core.Time
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DDSObject, Value<Time,ModifiableTime>
Direct Known Subclasses:
ModifiableTime

@Extensibility(value=FINAL_EXTENSIBILITY)
@Nested
public abstract class Time
extends java.lang.Object
implements Value<Time,ModifiableTime>

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

See Also:
Serialized Form

Constructor Summary
Time()
           
 
Method Summary
abstract  Time clone()
          Extends the concept of "cloneable" defined in java.lang by providing an explicit public Value.clone() method.
abstract  long getRemainder(java.util.concurrent.TimeUnit primaryUnit, java.util.concurrent.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.
abstract  long getTime(java.util.concurrent.TimeUnit inThisUnit)
          Truncate this time to a whole-number quantity of the given time unit.
static Time invalidTime(Bootstrap bootstrap)
           
abstract  boolean isValid()
           
static ModifiableTime newTime(long time, java.util.concurrent.TimeUnit units, Bootstrap bootstrap)
          Construct a specific instant in time.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omg.dds.core.Value
equals, hashCode, modify
 
Methods inherited from interface org.omg.dds.core.DDSObject
getBootstrap
 

Constructor Detail

Time

public Time()
Method Detail

newTime

public static ModifiableTime newTime(long time,
                                     java.util.concurrent.TimeUnit units,
                                     Bootstrap bootstrap)
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:
bootstrap - Identifies the Service instance to which the new object will belong.
See Also:
isValid()

invalidTime

public static Time invalidTime(Bootstrap bootstrap)
Parameters:
bootstrap - Identifies the Service instance to which the object will belong.
Returns:
An unmodifiable Time that is not valid.

getTime

public abstract long getTime(java.util.concurrent.TimeUnit inThisUnit)
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:
inThisUnit - The time unit in which the return result will be measured.
See Also:
getRemainder(TimeUnit, TimeUnit), Long.MAX_VALUE, TimeUnit

getRemainder

public abstract long getRemainder(java.util.concurrent.TimeUnit primaryUnit,
                                  java.util.concurrent.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. 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.HOURS 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 -
remainderUnit - The time unit in which the return result will be measured.
See Also:
getTime(TimeUnit), Long.MAX_VALUE, TimeUnit

isValid

public abstract boolean isValid()
Returns:
whether this time represents a meaningful instant in time.

clone

public abstract Time clone()
Description copied from interface: Value
Extends the concept of "cloneable" defined in java.lang by providing an explicit public Value.clone() method.

Specified by:
clone in interface Value<Time,ModifiableTime>
Overrides:
clone in class java.lang.Object
Returns:
a new object that with state identical to that of this object.


Copyright © 2010 Real-Time Innovations, Inc. (RTI)
Copyright © 2010 PrismTech, Ltd.
Copyright © 2010 Object Management Group, Inc. (OMG)
All Rights Reserved.