Package com.storedobject.core
Class MinutesTimestamp
java.lang.Object
java.util.Date
java.sql.Timestamp
com.storedobject.core.MinutesTimestamp
- All Implemented Interfaces:
Displayable,Serializable,Cloneable,Comparable<Date>
Represents a timestamp rounded to the nearest minute.
This class is an extension of
Timestamp and implements
the Displayable interface, ensuring that the time component
is always precise to the minute. Nanoseconds are always set to zero.
The primary purpose of this class is to provide accurate time precision
in minutes by truncating seconds and nanoseconds and offering a string
representation formatted to show hours and minutes.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aMinutesTimestampobject initialized to the current system time, rounded down to the nearest minute.MinutesTimestamp(long time) Constructs aMinutesTimestampinstance with the specified time in milliseconds. -
Method Summary
Methods inherited from class java.sql.Timestamp
after, before, compareTo, compareTo, equals, equals, from, hashCode, toInstant, toLocalDateTime, valueOf, valueOfMethods inherited from class java.util.Date
after, before, clone, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTimezoneOffset, getYear, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setYear, toGMTString, toLocaleString, UTC
-
Constructor Details
-
MinutesTimestamp
public MinutesTimestamp()Constructs aMinutesTimestampobject initialized to the current system time, rounded down to the nearest minute. This default constructor uses the system's current time in milliseconds to create a timestamp object while truncating the seconds and nanoseconds to ensure minute-level precision. -
MinutesTimestamp
public MinutesTimestamp(long time) Constructs aMinutesTimestampinstance with the specified time in milliseconds. The timestamp is rounded down to the nearest minute by truncating seconds and nanoseconds. Nanoseconds are always set to zero.- Parameters:
time- the time in milliseconds since the epoch, from which the minute-precise timestamp will be derived.
-
-
Method Details
-
toString
-
toDisplay
Description copied from interface:DisplayableConvert to a displayable string. The default implementation returns theStringUtility.toStringInt(Object)value.- Specified by:
toDisplayin interfaceDisplayable- Returns:
- A displayable string.
-
setTime
-
getTime
-
getNanos
-
setNanos
-