Package gaiasky.util.time
Class RealTimeClock
- java.lang.Object
-
- gaiasky.util.time.RealTimeClock
-
- All Implemented Interfaces:
ITimeFrameProvider
public class RealTimeClock extends java.lang.Object implements ITimeFrameProvider
Implements a real time clock. Time flows at the same pace as real life. Similar to GlobalClock with a time warp of 1.
-
-
Constructor Summary
Constructors Constructor Description RealTimeClock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetDt()The dt in hoursfloatgetFixedRate()Returns the fixed frame rate if the mode is fixed frame rate.java.time.InstantgetTime()Gets the current timedoublegetWarpFactor()Gets the current warp factorbooleanisFixedRateMode()Returns whether the frame rate is set to fixed or notbooleanisTimeOn()Is the time on?voidupdate(double dt)Updates this time frame with the system time difference
-
-
-
Method Detail
-
getDt
public double getDt()
The dt in hours- Specified by:
getDtin interfaceITimeFrameProvider- Returns:
- The time difference
-
getTime
public java.time.Instant getTime()
Description copied from interface:ITimeFrameProviderGets the current time- Specified by:
getTimein interfaceITimeFrameProvider- Returns:
- The time as an instant
-
update
public void update(double dt)
Description copied from interface:ITimeFrameProviderUpdates this time frame with the system time difference- Specified by:
updatein interfaceITimeFrameProvider- Parameters:
dt- System time difference in seconds
-
getWarpFactor
public double getWarpFactor()
Description copied from interface:ITimeFrameProviderGets the current warp factor- Specified by:
getWarpFactorin interfaceITimeFrameProvider- Returns:
- The warp factor
-
isFixedRateMode
public boolean isFixedRateMode()
Description copied from interface:ITimeFrameProviderReturns whether the frame rate is set to fixed or not- Specified by:
isFixedRateModein interfaceITimeFrameProvider- Returns:
- Whether fix rate mode is on
-
getFixedRate
public float getFixedRate()
Description copied from interface:ITimeFrameProviderReturns the fixed frame rate if the mode is fixed frame rate. Returns -1 otherwise- Specified by:
getFixedRatein interfaceITimeFrameProvider- Returns:
- The fixed rate
-
isTimeOn
public boolean isTimeOn()
Description copied from interface:ITimeFrameProviderIs the time on?- Specified by:
isTimeOnin interfaceITimeFrameProvider- Returns:
- True if time is on
-
-