Package de.digitalcollections.model.time
Class TimestampHelper
java.lang.Object
de.digitalcollections.model.time.TimestampHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDateTime
truncatedToMicros
(LocalDateTime value) Truncate the time part of aLocalDateTime
to microseconds.
-
Constructor Details
-
TimestampHelper
public TimestampHelper()
-
-
Method Details
-
truncatedToMicros
Truncate the time part of aLocalDateTime
to microseconds.In Java 17 the resolution of time objects increased from microseconds to nanoseconds. Java always stored a time with nanosecond precision but the last three digits have been zero. With the increase of resolution we are facing trouble with the persistence layer: most databases only support microseconds, so does ours. As a consequence the original object and the one retrieved from the database are different -- they differ in 1000 nanoseconds. To overcome this inconsistency the time values must be truncated to microseconds, the resolution that the database can store.
- Parameters:
value
-- Returns:
- the
LocalDateTime
truncated to microseconds
-