Package org.symbol.sdk
Class NetworkTimestamp.NetworkTimestampDatetimeConverter
java.lang.Object
org.symbol.sdk.NetworkTimestamp.NetworkTimestampDatetimeConverter
- Enclosing class:
NetworkTimestamp
- NetworkTimestampDatetimeConverter
- Provides utilities for converting between network timestamps and datetimes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTime units understood by this converter. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNetworkTimestampDatetimeConverter(Instant epoch, NetworkTimestamp.NetworkTimestampDatetimeConverter.TimeUnit timeUnits) Creates a converter given an epoch and base time units. -
Method Summary
Modifier and TypeMethodDescriptiontoDatetime(long rawTimestamp) Converts a network timestamp to a datetime.longtoDifference(Instant referenceDatetime) Subtracts the network epoch from the reference date.
-
Field Details
-
epoch
Date at which network started. -
timeUnits
public final long timeUnitsNumber of milliseconds per time unit.
-
-
Constructor Details
-
NetworkTimestampDatetimeConverter
public NetworkTimestampDatetimeConverter(Instant epoch, NetworkTimestamp.NetworkTimestampDatetimeConverter.TimeUnit timeUnits) Creates a converter given an epoch and base time units.- Parameters:
epoch- Date at which network started.timeUnits- Time unit the network uses for progressing.
-
-
Method Details
-
toDatetime
- NetworkTimestampDatetimeConverter.toDatetime
- Converts a network timestamp to a datetime.
- Parameters:
rawTimestamp- Raw network timestamp.- Returns:
- Datetime representation of the network timestamp.
-
toDifference
- NetworkTimestampDatetimeConverter.toDifference
- Subtracts the network epoch from the reference date.
- Parameters:
referenceDatetime- Reference date.- Returns:
- Number of network time units between the reference date and the network epoch.
-