@Immutable @ThreadSafe public final class Timestamp extends Object
Timestamp is required for historical operations in Concourse.
This class provides interoperability with Joda DateTime objects with
the fromJoda(DateTime) and getJoda() methods.| Modifier and Type | Field and Description |
|---|---|
static DateTimeFormatter |
DEFAULT_FORMATTER
The default formatter that is used to display objects of this class.
|
| Modifier and Type | Method and Description |
|---|---|
static Timestamp |
epoch()
Return a
Timestamp that corresponds to the system
epoch timestamp with microsecond precision. |
boolean |
equals(Object obj) |
static Timestamp |
fromJoda(DateTime joda)
Return the
Timestamp that corresponds to the provided joda
DateTime object. |
static Timestamp |
fromMicros(long microseconds)
Return a
Timestamp that corresponds to the provided Unix
timestamp with microsecond precision. |
static Timestamp |
fromString(String description)
|
DateTime |
getJoda()
Return the Joda
DateTime object that corresponds to this
Timestamp. |
long |
getMicros()
Return the number of microseconds since the Unix epoch that is
represented by this Timestamp.
|
int |
hashCode() |
static Timestamp |
now()
Return a
Timestamp set the current system microsecond time using
ISOChronology in the default time zone. |
static Timestamp |
now(Chronology chronology)
Return a
Timestamp set to the current system microsecond time
using the specified chronology. |
static Timestamp |
now(DateTimeZone zone)
Return a
Timestamp set to the current system microsecond time
using ISOChronology in the specified time zone. |
static Timestamp |
parse(String str,
DateTimeFormatter formatter)
Parses a
Timestamp from the specified string using a formatter. |
String |
toString() |
public static final DateTimeFormatter DEFAULT_FORMATTER
public static Timestamp epoch()
Timestamp that corresponds to the system
epoch timestamp with microsecond precision.public static Timestamp fromJoda(DateTime joda)
Timestamp that corresponds to the provided joda
DateTime object.joda - a DateTime objectjodapublic static Timestamp fromMicros(long microseconds)
Timestamp that corresponds to the provided Unix
timestamp with microsecond precision.microseconds - the number of microseconds since the Unix epochmicrosecondspublic static Timestamp fromString(String description)
description and return a Timestamp that can be
passed to driver API methods.
Timestamp description are parsed by Concourse Server, so this method only
returns a wrapper that is meant to be passed over the wire. Timestamps
returned from this method are non-operable and will throw
exceptions if you call methods that would return a precise instant (i.e.
getJoda() or getMicros()).
description - a relative or absolute natural language description of
an instant.Timestamp that wraps the descriptionpublic static Timestamp now()
Timestamp set the current system microsecond time using
ISOChronology in the default time zone.public static Timestamp now(Chronology chronology)
Timestamp set to the current system microsecond time
using the specified chronology.chronology - the chronology, not nullpublic static Timestamp now(DateTimeZone zone)
Timestamp set to the current system microsecond time
using ISOChronology in the specified time zone.zone - the time zone, not nullpublic static Timestamp parse(String str, DateTimeFormatter formatter)
Timestamp from the specified string using a formatter.str - the string to parse, not nullformatter - the formatter to use, not nullpublic DateTime getJoda()
DateTime object that corresponds to this
Timestamp.public long getMicros()