Package gaiasky.util.time
Class RealTimeClock
java.lang.Object
gaiasky.util.time.RealTimeClock
- All Implemented Interfaces:
ITimeFrameProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
getDt()
The frame time difference in seconds.float
Returns the fixed frame rate if the mode is fixed frame rate.double
getHdiff()
The dt in hoursgetTime()
Gets the current time in UTC.double
Gets the current warp factorboolean
Returns whether the frame rate is set to fixed or notboolean
isTimeOn()
Is the time on?void
update
(double dt) Updates this time frame with the system time difference
-
Constructor Details
-
RealTimeClock
public RealTimeClock()
-
-
Method Details
-
getHdiff
public double getHdiff()The dt in hours- Specified by:
getHdiff
in interfaceITimeFrameProvider
- Returns:
- The simulation time difference in hours.
-
getDt
public double getDt()Description copied from interface:ITimeFrameProvider
The frame time difference in seconds.- Specified by:
getDt
in interfaceITimeFrameProvider
- Returns:
- The frame time difference in seconds.
-
getTime
Description copied from interface:ITimeFrameProvider
Gets the current time in UTC.- Specified by:
getTime
in interfaceITimeFrameProvider
- Returns:
- The time as an instant, in UTC.
-
update
public void update(double dt) Description copied from interface:ITimeFrameProvider
Updates this time frame with the system time difference- Specified by:
update
in interfaceITimeFrameProvider
- Parameters:
dt
- System time difference in seconds
-
getWarpFactor
public double getWarpFactor()Description copied from interface:ITimeFrameProvider
Gets the current warp factor- Specified by:
getWarpFactor
in interfaceITimeFrameProvider
- Returns:
- The warp factor
-
isFixedRateMode
public boolean isFixedRateMode()Description copied from interface:ITimeFrameProvider
Returns whether the frame rate is set to fixed or not- Specified by:
isFixedRateMode
in interfaceITimeFrameProvider
- Returns:
- Whether fix rate mode is on
-
getFixedRate
public float getFixedRate()Description copied from interface:ITimeFrameProvider
Returns the fixed frame rate if the mode is fixed frame rate. Returns -1 otherwise- Specified by:
getFixedRate
in interfaceITimeFrameProvider
- Returns:
- The fixed rate
-
isTimeOn
public boolean isTimeOn()Description copied from interface:ITimeFrameProvider
Is the time on?- Specified by:
isTimeOn
in interfaceITimeFrameProvider
- Returns:
- True if time is on
-