Package io.github.srcimon.screwbox.core
Class Time
java.lang.Object
io.github.srcimon.screwbox.core.Time
- All Implemented Interfaces:
Serializable
Represents a specific
Time
after starting the Engine
. Can
only be used to measure Duration
s relative to other Time
instances. Loses meaning when shutting down the JVM.- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAdd the given value measured asTime.Unit
.addMillis
(long milliseconds) addSeconds
(long seconds) static Time
atNanos
(long nanos) Returns the a new instance for a specificTime
whithin the JVM.boolean
int
hashCode()
boolean
Specifies if this instance is after the givenTime
instance.boolean
Specifies if this instance is before the givenTime
instance.boolean
isSet()
Returnstrue
if this instance is not unset.boolean
isUnset()
Returnstrue
if this instance is unset.long
The seconds value that represents the currentTime
.long
nanos()
The nanoseconds value that represents the currentTime
.static Time
now()
Returns a new instance for the currentTime
.toString()
static Time
unset()
Returns the a new instance of the oldest possibleTime
.
-
Method Details
-
unset
Returns the a new instance of the oldest possibleTime
. -
now
Returns a new instance for the currentTime
. -
atNanos
Returns the a new instance for a specificTime
whithin the JVM. Can be handy for testing purposes. -
nanos
public long nanos()The nanoseconds value that represents the currentTime
. -
milliseconds
public long milliseconds()The seconds value that represents the currentTime
. -
hashCode
public int hashCode() -
equals
-
add
Add the given value measured asTime.Unit
. -
addSeconds
- See Also:
-
addMillis
- See Also:
-
isAfter
Specifies if this instance is after the givenTime
instance. -
isBefore
Specifies if this instance is before the givenTime
instance. -
toString
-
isUnset
public boolean isUnset()Returnstrue
if this instance is unset.- See Also:
-
isSet
public boolean isSet()Returnstrue
if this instance is not unset.- See Also:
-