Package org.alban098.common
Class Timer
java.lang.Object
org.alban098.common.Timer
This class represent an accurate timer used to calculate update and frame times
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longThe time at which the last frame has ended -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleGet the elapsed time since the last call of this methoddoubleGet the time of the last call to getElapsedTime() in secondslonggetTime()Get the current tim in seconds, accurate to nanoseconds
-
Field Details
-
lastFrameTime
private long lastFrameTimeThe time at which the last frame has ended
-
-
Constructor Details
-
Timer
public Timer()Creates and initializes a new Timer
-
-
Method Details
-
getTime
public long getTime()Get the current tim in seconds, accurate to nanoseconds- Returns:
- the current time in seconds
-
getElapsedTime
public double getElapsedTime()Get the elapsed time since the last call of this method- Returns:
- elapsed time since last call, in seconds
-
getLastFrameTime
public double getLastFrameTime()Get the time of the last call to getElapsedTime() in seconds- Returns:
- the time of the last call to getElapsedTime() in seconds
-