gov.sns.ca
Class Timestamp

java.lang.Object
  |
  +--gov.sns.ca.Timestamp
All Implemented Interfaces:
java.lang.Comparable

public class Timestamp
extends java.lang.Object
implements java.lang.Comparable

Timestamp


Field Summary
protected  java.math.BigDecimal _timestamp
           
 
Constructor Summary
Timestamp(java.math.BigDecimal timestamp)
          Construct a Timestamp from the full precision seconds since the Java epoch.
Timestamp(java.sql.Timestamp timestamp)
          Construct a Timestamp from a java.sql.Timestamp
 
Method Summary
 int compareTo(java.lang.Object otherTimestamp)
          Compare this timestamp with another timestamp.
 java.util.Date getDate()
          Get the times tamp as a Java Date.
 java.math.BigDecimal getFullSeconds()
          Get the time in seconds with full precision since the Java epoch.
 double getSeconds()
          Get the time in seconds since the Java epoch.
 java.sql.Timestamp getSQLTimestamp()
          Get the SQL Timestamp equivalent of this instance.
 long getTime()
          Get the timestamp in milliseconds relative to the Java epoch.
 java.lang.String toString()
          Get a string representation of the Timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_timestamp

protected java.math.BigDecimal _timestamp
Constructor Detail

Timestamp

public Timestamp(java.math.BigDecimal timestamp)
Construct a Timestamp from the full precision seconds since the Java epoch.


Timestamp

public Timestamp(java.sql.Timestamp timestamp)
Construct a Timestamp from a java.sql.Timestamp

Method Detail

getDate

public java.util.Date getDate()
Get the times tamp as a Java Date. Some precision is lost since the Date class only supports millisecond resolution.

Returns:
The time stamp as a Date.

getTime

public long getTime()
Get the timestamp in milliseconds relative to the Java epoch.

Returns:
The time in milliseconds since the Java epoch.

getSeconds

public double getSeconds()
Get the time in seconds since the Java epoch.

Returns:
the time in seconds since the Java epoch.

getFullSeconds

public java.math.BigDecimal getFullSeconds()
Get the time in seconds with full precision since the Java epoch.

Returns:
the time in seconds since the Java epoch.

getSQLTimestamp

public java.sql.Timestamp getSQLTimestamp()
Get the SQL Timestamp equivalent of this instance.

Returns:
the SQL Timestamp equivalent of this instance.

toString

public java.lang.String toString()
Get a string representation of the Timestamp.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the Timestamp

compareTo

public int compareTo(java.lang.Object otherTimestamp)
Compare this timestamp with another timestamp.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
otherTimestamp - The timestamp with which to compare this one
Returns:
0 if the timestamps are the same, negative if this is earlier than the supplied one and positive otherwise