public class ServicesTimestampLongConverter extends Object implements LongConverter
LongConverter for converting timestamps that represent service times.
This class allows for system-wide time unit configuration using a system property: 'service.time.unit'.
The supported time units are nanoseconds (ns), microseconds (us), and milliseconds (ms). If the system property
is not set, it defaults to nanoseconds.| Modifier and Type | Field and Description |
|---|---|
static ServicesTimestampLongConverter |
INSTANCE |
| Constructor and Description |
|---|
ServicesTimestampLongConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Appends a representation of the provided long timestamp (in the configured time unit) to the provided
Bytes. |
void |
append(StringBuilder text,
long value)
Appends a representation of the provided long timestamp (in the configured time unit) to the provided
StringBuilder. |
static long |
currentTime() |
static long |
currentTime(net.openhft.chronicle.core.time.TimeProvider clock) |
long |
parse(CharSequence text)
Parses the provided
CharSequence into a timestamp in the configured time unit. |
static TimeUnit |
timeUnit() |
static long |
toTime(long arg)
Converts the given long value to the configured time unit.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddEncode, allSafeChars, asString, asText, asText, forSymbols, lengthCheck, maxParseLength, maxParseLength@UsedViaReflection public static final ServicesTimestampLongConverter INSTANCE
public static long toTime(long arg)
arg - The long value to convert.public static long currentTime()
public static long currentTime(net.openhft.chronicle.core.time.TimeProvider clock)
public static TimeUnit timeUnit()
public long parse(CharSequence text)
CharSequence into a timestamp in the configured time unit.parse in interface LongConvertertext - The text to parse.public void append(StringBuilder text, long value)
StringBuilder.append in interface LongConvertertext - The StringBuilder to append to.value - The timestamp as a long value in the configured time unit.public void append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Bytes.append in interface LongConverterbytes - The Bytes to append to.value - The timestamp as a long value in the configured time unit.Copyright © 2023. All rights reserved.