Class Stopwatch
java.lang.Object
lol.trq.helios.anim.Stopwatch
Measures elapsed time since the last reset; the building block for cooldowns and delays.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanelapsed(long millis) Returns whether at least some time has passed.booleanelapsedAndReset(long millis) Returns whether some time has passed and, if so, resets: a cooldown in one call.longmillis()Returns the elapsed time.longnanos()Returns the elapsed time.reset()Restarts from zero.
-
Constructor Details
-
Stopwatch
public Stopwatch()Starts a stopwatch on the system clock. -
Stopwatch
-
-
Method Details
-
reset
-
millis
public long millis()Returns the elapsed time.- Returns:
- milliseconds since the last reset
-
nanos
public long nanos()Returns the elapsed time.- Returns:
- nanoseconds since the last reset
-
elapsed
public boolean elapsed(long millis) Returns whether at least some time has passed.- Parameters:
millis- the time- Returns:
- true once
millishave elapsed
-
elapsedAndReset
public boolean elapsedAndReset(long millis) Returns whether some time has passed and, if so, resets: a cooldown in one call.- Parameters:
millis- the time- Returns:
- true at most once per
millis
-