Package security.whisper.javastix.common
Class StixInstant
java.lang.Object
security.whisper.javastix.common.StixInstant
Stores a Java.time Instant and stores the original sub-second precision digital count.
SubSecond precision count means that the number of digits (even if all zeros / trailing zeros) are remembered.
Use toString() to get the Stix string format for the datetime.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenerates a Instant.now() Defaults to 3 digits of sub second precision (milliseconds)StixInstant(Instant instant) Defaults with parsed Instant's Nano second precision digit count.StixInstant(Instant instant, int subSecondPrecision) -
Method Summary
Modifier and TypeMethodDescriptionGet the underlying Instant value.intstatic StixInstantnow()Static factory method for creating a StixInstant with the current time.static StixInstanttoString()Generates a STIX Spec String of DateTime.toString(int subSecondPrecision)
-
Field Details
-
REGEX_SUBSECOND
-
-
Constructor Details
-
StixInstant
public StixInstant()Generates a Instant.now() Defaults to 3 digits of sub second precision (milliseconds) -
StixInstant
-
StixInstant
Defaults with parsed Instant's Nano second precision digit count. Note that trailing zeros would have been stripped. If you need to keep exact precision, including the trailing zeros, useStixInstant(Instant, int)
-
-
Method Details
-
now
Static factory method for creating a StixInstant with the current time. Defaults to 3 digits of sub second precision (milliseconds). This is the preferred way to create a StixInstant representing "now".- Returns:
- A new StixInstant representing the current moment
-
getInstant
Get the underlying Instant value. If you need the Stix Date with the Stix Precision then usetoString()getInstant() should only be used in special cases where you need access to perform temporal work. -
getOriginalSubSecondPrecisionDigitCount
public int getOriginalSubSecondPrecisionDigitCount() -
toString
Generates a STIX Spec String of DateTime. UsesStixDataFormats.getWriterStixDateTimeFormatter(int) -
toString
-
parse
-