|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metsci.glimpse.util.units.time.TimeStamp
public abstract class TimeStamp
Field Summary | |
---|---|
static TimeStampFormat |
defaultFormat
The format used by the convenience methods fromString(String) and
toString() . |
Method Summary | |
---|---|
abstract TimeStamp |
add(double duration)
Creates a new TimeStamp instance offset from this timestamp by the given amount. |
int |
compareTo(TimeStamp o)
|
static TimeStamp |
currentTime()
Creates a TimeStamp that represents the current system time. |
double |
durationAfter(TimeStamp o)
Determines how long after the given timestamp this timestamp is. |
double |
durationBefore(TimeStamp o)
Determines how long before the given timestamp this timestamp is. |
boolean |
equals(java.lang.Object o)
|
static TimeStamp |
fromCalendar(java.util.Calendar calendar)
Converts a Calendar to a TimeStamp. |
static TimeStamp |
fromDate(java.util.Date date)
Converts a Date to a TimeStamp. |
static TimeStamp |
fromPosixMicros(long posixMicros)
Converts a timestamp in posix microseconds to a TimeStamp. |
static TimeStamp |
fromPosixMillis(long posixMillis)
Converts a timestamp in posix milliseconds to a TimeStamp. |
static TimeStamp |
fromPosixNanos(long posixNanos)
Converts a timestamp in posix nanoseconds to a TimeStamp. |
static TimeStamp |
fromPosixSeconds(java.math.BigDecimal posixSeconds)
Converts a timestamp in posix seconds to a TimeStamp. |
static TimeStamp |
fromPosixSeconds(double posixSeconds)
Converts a timestamp in posix seconds to a TimeStamp. |
static TimeStamp |
fromString(java.lang.String string)
Converts a String to a TimeStamp, using defaultFormat . |
static TimeStamp |
fromString(java.lang.String string,
TimeStampFormat format)
Converts a String to a TimeStamp. |
static TimeStamp |
fromTimeStamp(TimeStamp timeStamp)
Converts a TimeStamp of any subclass to a TimeStamp of the default subclass. |
int |
hashCode()
|
boolean |
isAfter(TimeStamp o)
Returns true iff this timestamp is after the given timestamp. |
boolean |
isAfterOrEquals(TimeStamp o)
Returns true iff this timestamp is after or equal to the given timestamp. |
boolean |
isBefore(TimeStamp o)
Returns true iff this timestamp is before the given timestamp. |
boolean |
isBeforeOrEquals(TimeStamp o)
Returns true iff this timestamp is before or equal to the given timestamp. |
static TimeStamp |
posixEpoch()
Returns a TimeStamp that represents the posix epoch. |
abstract TimeStamp |
subtract(double duration)
Creates a new TimeStamp instance offset from this timestamp by the given amount. |
abstract java.util.Calendar |
toCalendar()
Converts this TimeStamp to a Calendar . |
abstract java.util.Date |
toDate()
Converts this TimeStamp to a Date . |
abstract long |
toPosixMicros()
Converts this TimeStamp to posix microseconds. |
abstract long |
toPosixMillis()
Converts this TimeStamp to posix milliseconds. |
abstract long |
toPosixNanos()
Converts this TimeStamp to posix nanoseconds. |
abstract double |
toPosixSeconds()
Converts this TimeStamp to posix seconds. |
abstract java.math.BigDecimal |
toPosixSecondsExact()
Converts this TimeStamp to posix seconds. |
java.lang.String |
toString()
Converts this timestamp to a String , according to defaultFormat . |
java.lang.String |
toString(TimeStampFormat format)
Converts this timestamp to a String , according to the given format. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final TimeStampFormat defaultFormat
fromString(String)
and
toString()
. It refers to TimeStampFormat.iso8601
.
Method Detail |
---|
public static TimeStamp fromPosixSeconds(double posixSeconds)
posixSeconds
- seconds since the epochpublic static TimeStamp fromPosixSeconds(java.math.BigDecimal posixSeconds)
posixSeconds
- seconds since the epochpublic static TimeStamp fromPosixMillis(long posixMillis)
posixMillis
- milliseconds since the epochpublic static TimeStamp fromPosixMicros(long posixMicros)
posixMicros
- microseconds since the epochpublic static TimeStamp fromPosixNanos(long posixNanos)
posixNanos
- nanoseconds since the epochpublic static TimeStamp fromTimeStamp(TimeStamp timeStamp)
java.lang.NullPointerException
- if argument is nullpublic static TimeStamp fromDate(java.util.Date date)
Date
to a TimeStamp.
java.lang.NullPointerException
- if argument is nullpublic static TimeStamp fromCalendar(java.util.Calendar calendar)
Calendar
to a TimeStamp.
java.lang.NullPointerException
- if argument is nullpublic static TimeStamp fromString(java.lang.String string, TimeStampFormat format) throws TimeStampParseException
String
to a TimeStamp.
java.lang.NullPointerException
- if either argument is null
TimeStampParseException
- if string parsing failspublic static TimeStamp fromString(java.lang.String string) throws TimeStampParseException
String
to a TimeStamp, using defaultFormat
.
java.lang.NullPointerException
- if either argument is null
TimeStampParseException
- if string parsing failspublic static TimeStamp posixEpoch()
public static TimeStamp currentTime()
public abstract TimeStamp add(double duration)
duration
- the amount of time to add in system-unitspublic abstract TimeStamp subtract(double duration)
duration
- the amount of time to subtract in system-unitspublic double durationBefore(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic double durationAfter(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic abstract double toPosixSeconds()
public abstract long toPosixMillis()
public abstract long toPosixMicros()
public abstract long toPosixNanos()
public abstract java.util.Date toDate()
Date
.
public abstract java.util.Calendar toCalendar()
Calendar
.
public abstract java.math.BigDecimal toPosixSecondsExact()
public boolean isBefore(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic boolean isBeforeOrEquals(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic boolean isAfter(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic boolean isAfterOrEquals(TimeStamp o)
java.lang.NullPointerException
- if argument is nullpublic int compareTo(TimeStamp o)
compareTo
in interface java.lang.Comparable<TimeStamp>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString(TimeStampFormat format)
String
, according to the given format.
public java.lang.String toString()
String
, according to defaultFormat
.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |