Class TimeNanosUtil
A collection of static utility methods for manipulation of time measured in nanoseconds since Unix epoch.
Porting Java class com.dxfeed.event.impl.TimeNanosUtil
.
public static class TimeNanosUtil
- Inheritance
-
TimeNanosUtil
- Inherited Members
Methods
GetMillisFromNanos(long)
Returns time measured in milliseconds since Unix epoch from the time in nanoseconds. Idea is that nano part of time shall be within [0..999999] interval so that the following equation always holds:
GetMillisFromNanos(timeNanos) * 1_000_000 + GetNanoPartFromNanos(timeNanos) == timeNanos
GetNanoPartFromNanos(long)
public static long GetMillisFromNanos(long timeNanos)
Parameters
timeNanos
longThe time measured in nanoseconds since Unix epoch.
Returns
- long
The time measured in milliseconds since Unix epoch.
GetNanoPartFromNanos(long)
Returns nano part of time. Idea is that nano part of time shall be within [0..999999] interval so that the following equation always holds:
GetMillisFromNanos(timeNanos) * 1_000_000 + GetNanoPartFromNanos(timeNanos) == timeNanos
GetMillisFromNanos(long)
public static int GetNanoPartFromNanos(long timeNanos)
Parameters
timeNanos
longThe time measured in nanoseconds since Unix epoch.
Returns
- int
The time measured in milliseconds since Unix epoch.
GetNanosFromMillisAndNanoPart(long, int)
Returns time measured in nanoseconds since Unix epoch from the time in milliseconds and its nano part.
The result of this method is timeMillis * 1_000_000 + timeNanoPart
.
public static long GetNanosFromMillisAndNanoPart(long timeMillis, int timeNanoPart)
Parameters
timeMillis
longThe time in milliseconds since Unix epoch.
timeNanoPart
intThe nanoseconds part that shall lie within [0..999999] interval.
Returns
- long
The time measured in nanoseconds since Unix epoch.