public abstract class AbstractTimestampLongConverter extends Object implements LongConverter
All long values that are handled by this converter are assumed to be timestamps in UTC.
Parsing of ISO dates, with or without timestamps, is supported. If an ISO date is read with no timezone, it is assumed to be in the converter's zone.
| Modifier and Type | Field and Description |
|---|---|
static String |
TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY
System property to specify the ZoneId for timestamp conversion.
|
static ZoneId |
UTC
Universal Time Coordinated (UTC) timezone
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTimestampLongConverter(String zoneId,
TimeUnit timeUnit)
Constructs a new
AbstractTimestampLongConverter with the specified
zone ID and time unit. |
protected |
AbstractTimestampLongConverter(TimeUnit timeUnit)
Constructs a new
AbstractTimestampLongConverter with the specified time unit. |
| Modifier and Type | Method and Description |
|---|---|
void |
append(Appendable text,
long value)
Format the timestamp value and append it to the supplied
Appendable. |
void |
append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Convenience overload for appending to a
Bytes instance. |
void |
append(StringBuilder text,
long value)
Convenience overload that delegates to
append(Appendable, long). |
protected abstract void |
appendFraction(DateTimeFormatterBuilder builder)
Append the fraction-of-second pattern to the formatter builder.
|
long |
parse(CharSequence text)
Parses the provided text and converts it into a long timestamp.
|
protected abstract long |
parseFormattedDate(ZonedDateTime value)
Interpret a formatted date that has already been normalised to UTC.
|
protected abstract long |
parseTimestamp(long value,
CharSequence text)
Interpret a long value that has been parsed directly from the input text.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddEncode, allSafeChars, asString, asText, asText, forSymbols, lengthCheck, lengthCheck, maxParseLength, maxParseLength, parsepublic static final ZoneId UTC
public static final String TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY
protected AbstractTimestampLongConverter(TimeUnit timeUnit)
AbstractTimestampLongConverter with the specified time unit.
The zone ID is fetched from the system property. If the system property is not set, UTC is used.timeUnit - the time unit for the conversion of long valuesprotected AbstractTimestampLongConverter(String zoneId, TimeUnit timeUnit)
AbstractTimestampLongConverter with the specified
zone ID and time unit.zoneId - The string representation of the ZoneId (for
example "UTC" or "Europe/London") used when a parsed date
does not contain its own offset. All internal long values
are treated as UTC based.timeUnit - The TimeUnit defining the precision of the long
timestamp values handled by this converter.public long parse(CharSequence text)
ZoneId is assumed.parse in interface LongConvertertext - The character sequence representing a date, timestamp or
numeric value to be parsed into a UTC long in this
converter's TimeUnit.protected abstract long parseFormattedDate(ZonedDateTime value)
value - The ZonedDateTime parsed from the text and adjusted
to UTC. The implementation extracts the epoch based long in
this converter's TimeUnit.protected abstract long parseTimestamp(long value,
CharSequence text)
value - The numeric value extracted from text before any unit
conversion is applied.text - The original character sequence. Implementations may use it
for logging or context when the conversion is ambiguous.protected abstract void appendFraction(DateTimeFormatterBuilder builder)
builder - The DateTimeFormatterBuilder after the basic date
and time pattern has been added.public void append(Appendable text, long value)
Appendable.text - The destination for the formatted date-time, such as a
StringBuilder or Bytes instance.value - The UTC timestamp in this converter's TimeUnit.public void append(StringBuilder text, long value)
append(Appendable, long).append in interface LongConvertertext - The StringBuilder to receive the formatted value.value - The UTC timestamp in this converter's TimeUnit.public void append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Bytes instance.append in interface LongConverterbytes - The Bytes sink for the formatted value.value - The UTC timestamp in this converter's TimeUnit.Copyright © 2026 Chronicle Software Ltd. All rights reserved.