public class ServicesTimestampLongConverter extends Object implements LongConverter
LongConverter interface.
The class is specifically designed to convert timestamps representing service times across different
units: nanoseconds (ns), microseconds (us), and milliseconds (ms). The preferred time unit can be
specified system-wide using the 'service.time.unit' system property. If not explicitly set, the default
unit will be 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 system-configured time unit) to the provided
Bytes. |
void |
append(StringBuilder text,
long value)
Appends a representation of the provided long timestamp (in the system-configured time unit) to the provided
StringBuilder. |
static long |
currentTime()
Fetches the current time in the system-configured time unit using the default CLOCK.
|
static long |
currentTime(net.openhft.chronicle.core.time.TimeProvider clock)
Fetches the current time in the system-configured time unit using the provided TimeProvider.
|
long |
parse(CharSequence text)
Parses the provided
CharSequence into a timestamp in the configured time unit. |
long |
parse(CharSequence text,
int beginIndex,
int endIndex)
Parses a part of the provided
CharSequence using the underlying converter. |
static TimeUnit |
timeUnit()
Returns the current system-configured time unit.
|
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, allSafeChars, asString, asText, asText, forSymbols, lengthCheck, 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)
clock - The TimeProvider to fetch the current time.public static TimeUnit 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 long parse(CharSequence text, int beginIndex, int endIndex)
CharSequence using the underlying converter.parse in interface LongConvertertext - the text to parse.beginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.public void append(StringBuilder text, long value)
StringBuilder.append in interface LongConvertertext - The StringBuilder to which the timestamp representation will be appended.value - The timestamp as a long value in the system-configured time unit.public void append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Bytes.append in interface LongConverterbytes - The Bytes object to which the timestamp representation will be appended.value - The timestamp as a long value in the system-configured time unit.Copyright © 2024. All rights reserved.