ucar.unidata.util
Class Timestamp

java.lang.Object
  extended by ucar.unidata.util.Timestamp
All Implemented Interfaces:
Serializable, Comparable

public class Timestamp
extends Object
implements Comparable, Serializable

A immutable timestamp and related utilities. Hopefully lighter weight than java.util.Date (which is mutable), and we don't have to trip over javasoft/Taligent deprecations.

We are using the java "long millisecs since the epoch" as internal representation. This doesn't roll over until August of 292,278,994.

Version:
$Revision: 1.13 $ $Date: 2006/05/05 19:19:38 $
Author:
$Author: jeffmc $
See Also:
Serialized Form

Field Summary
protected  long millis_
          _more_
static Timestamp NONE
          _more_
 
Constructor Summary
Timestamp()
          Construct a Timestamp and initialized to the current time.
Timestamp(Date date)
          Construct a Timestamp and initialized by a Date object.
Timestamp(int secsPrior)
          Construct a Timestamp initialized by current time minus given seconds.
Timestamp(long millis)
          Construct a Timestamp and initialized to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
 
Method Summary
 int compareTo(Object oo)
          _more_
 int compareTo(Timestamp ts)
          _more_
 boolean equals(Object oo)
          _more_
 StringBuffer format(StringBuffer buf)
          _more_
 long getMillis()
           
 int hashCode()
          _more_
static void main(String[] args)
          _more_
 String toString()
          _more_
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Timestamp NONE
_more_


millis_

protected final long millis_
_more_

Constructor Detail

Timestamp

public Timestamp(long millis)
Construct a Timestamp and initialized to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Parameters:
millis - long milliseconds since January 1, 1970, 00:00:00 GMT
See Also:
System.currentTimeMillis()

Timestamp

public Timestamp()
Construct a Timestamp and initialized to the current time.

See Also:
System.currentTimeMillis()

Timestamp

public Timestamp(Date date)
Construct a Timestamp and initialized by a Date object.

Parameters:
date -
See Also:
Date

Timestamp

public Timestamp(int secsPrior)
Construct a Timestamp initialized by current time minus given seconds.

Parameters:
secsPrior - number oif seconds prior to current time
Method Detail

getMillis

public long getMillis()
Returns:
long time value represented by this, in number of milliseconds since January 1, 1970, 00:00:00 GMT

format

public StringBuffer format(StringBuffer buf)
_more_

Parameters:
buf -
Returns:
_more_

hashCode

public int hashCode()
_more_

Overrides:
hashCode in class Object
Returns:
_more_

equals

public boolean equals(Object oo)
_more_

Overrides:
equals in class Object
Parameters:
oo -
Returns:
_more_

toString

public String toString()
_more_

Overrides:
toString in class Object
Returns:
_more_

compareTo

public int compareTo(Timestamp ts)
_more_

Parameters:
ts -
Returns:
_more_

compareTo

public int compareTo(Object oo)
_more_

Specified by:
compareTo in interface Comparable
Parameters:
oo -
Returns:
_more_

main

public static void main(String[] args)
_more_

Parameters:
args -