Class 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
      double getDt()
      The dt in hours
      float getFixedRate()
      Returns the fixed frame rate if the mode is fixed frame rate.
      java.time.Instant getTime()
      Gets the current time
      double getWarpFactor()
      Gets the current warp factor
      boolean isFixedRateMode()
      Returns whether the frame rate is set to fixed or not
      boolean isTimeOn()
      Is the time on?
      void update​(double dt)
      Updates this time frame with the system time difference
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RealTimeClock

        public RealTimeClock()
    • Method Detail

      • getDt

        public double getDt()
        The dt in hours
        Specified by:
        getDt in interface ITimeFrameProvider
        Returns:
        The time difference
      • update

        public void update​(double dt)
        Description copied from interface: ITimeFrameProvider
        Updates this time frame with the system time difference
        Specified by:
        update in interface ITimeFrameProvider
        Parameters:
        dt - System time difference in seconds
      • isFixedRateMode

        public boolean isFixedRateMode()
        Description copied from interface: ITimeFrameProvider
        Returns whether the frame rate is set to fixed or not
        Specified by:
        isFixedRateMode in interface ITimeFrameProvider
        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 interface ITimeFrameProvider
        Returns:
        The fixed rate