org.epics.pvmanager.util
Class TimeStamp

java.lang.Object
  extended by org.epics.pvmanager.util.TimeStamp
All Implemented Interfaces:
java.lang.Comparable<TimeStamp>

Deprecated. This class is being retired in favor of Timestamp

@Deprecated
public class TimeStamp
extends java.lang.Object
implements java.lang.Comparable<TimeStamp>

Represent a time stamp at nanosecond accuracy. The time is internally stored as two values: the UNIX timestamp (number of seconds since 1/1/1970) and the nanoseconds past that timestamp. The UNIX timestamp is stored as a signed long, which has the range of 292 billion years before and another 292 past the epoch.

Note that while TimeStamp are usually created according to system clocks which takes into account leap seconds, all the math operations on TimeStamps do not take leap seconds into account.

Author:
carcassi

Method Summary
 java.util.Date asDate()
          Deprecated. Converts the time stamp to a standard Date.
 Timestamp asTimestamp()
          Deprecated. Converts to the epics common definition of time.
static Timestamp asTimestamp(TimeStamp timeStamp)
          Deprecated. Null safe way of converting to the epics common definition of time.
 int compareTo(TimeStamp other)
          Deprecated. Defines the natural ordering for timestamp as forward in time.
 TimeDuration durationFrom(TimeStamp reference)
          Deprecated. Calculates the time passed from the reference to this timeStamp.
 boolean equals(java.lang.Object obj)
          Deprecated.  
 long getNanoSec()
          Deprecated. Nanoseconds within the given second.
 long getSec()
          Deprecated. Unix time; seconds from midnight 1/1/1970.
 int hashCode()
          Deprecated.  
 TimeStamp minus(TimeDuration duration)
          Deprecated. Subtracts the given duration to this timestamp and returns the result.
static TimeStamp now()
          Deprecated. Returns a new timestamp for the current instant.
 TimeStamp plus(TimeDuration duration)
          Deprecated. Adds the given duration to this timestamp and returns the result.
static TimeStamp time(long unixSec, int nanoSec)
          Deprecated. Returns a new timestamp from UNIX time.
static TimeStamp timestampOf(java.util.Date date)
          Deprecated. Converts a Date to a timestamp.
static TimeStamp timestampOf(Timestamp timestamp)
          Deprecated.  
 java.lang.String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getSec

public long getSec()
Deprecated. 
Unix time; seconds from midnight 1/1/1970.

Returns:
unix time

getNanoSec

public long getNanoSec()
Deprecated. 
Nanoseconds within the given second.

Returns:
nanoseconds (0 < nanoSec < 999,999,999)

time

public static TimeStamp time(long unixSec,
                             int nanoSec)
Deprecated. 
Returns a new timestamp from UNIX time.

Parameters:
unixSec - number of seconds in the UNIX epoch.
nanoSec - nanoseconds past the given seconds (must be 0 < nanoSec < 999,999,999)
Returns:
a new timestamp

timestampOf

public static TimeStamp timestampOf(java.util.Date date)
Deprecated. 
Converts a Date to a timestamp. Date is accurate to milliseconds, so the last 6 digits are always going to be zeros.

Parameters:
date - the date to convert
Returns:
a new timestamp

timestampOf

public static TimeStamp timestampOf(Timestamp timestamp)
Deprecated. 

now

public static TimeStamp now()
Deprecated. 
Returns a new timestamp for the current instant. The timestamp is calculated using System.nanoTime(), so it has the accuracy given by that function.

Returns:
a new timestamp

asDate

public java.util.Date asDate()
Deprecated. 
Converts the time stamp to a standard Date. The conversion is done once, and it trims all precision below milliSec.

Returns:
a date

asTimestamp

public Timestamp asTimestamp()
Deprecated. 
Converts to the epics common definition of time.


asTimestamp

public static Timestamp asTimestamp(TimeStamp timeStamp)
Deprecated. 
Null safe way of converting to the epics common definition of time.

Parameters:
timeStamp - the timeStamp to convert
Returns:
a new timestamp

hashCode

public int hashCode()
Deprecated. 
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Deprecated. 
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(TimeStamp other)
Deprecated. 
Defines the natural ordering for timestamp as forward in time.

Specified by:
compareTo in interface java.lang.Comparable<TimeStamp>
Parameters:
other - another object
Returns:
comparison result

plus

public TimeStamp plus(TimeDuration duration)
Deprecated. 
Adds the given duration to this timestamp and returns the result.

Parameters:
duration - a time duration
Returns:
a new timestamp

minus

public TimeStamp minus(TimeDuration duration)
Deprecated. 
Subtracts the given duration to this timestamp and returns the result.

Parameters:
duration - a time duration
Returns:
a new timestamp

toString

public java.lang.String toString()
Deprecated. 
Overrides:
toString in class java.lang.Object

durationFrom

public TimeDuration durationFrom(TimeStamp reference)
Deprecated. 
Calculates the time passed from the reference to this timeStamp. The resulting duration is the absolute value, so it does not matter on which object the function is called.

Parameters:
reference - another time stamp
Returns:
the duration between the two timeStamps