Class SimpleVirtualClock

  • All Implemented Interfaces:
    deltix.qsrv.hf.pub.TimeSource

    public class SimpleVirtualClock
    extends java.lang.Object
    implements deltix.qsrv.hf.pub.TimeSource
    Implements virtual clock that may run with specified speed and from specified virtual time. Speed may be changed dynamically. Clock may be paused.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleVirtualClock​(double speed, deltix.qsrv.hf.pub.TimeSource baseTimeSource)  
    • Constructor Detail

      • SimpleVirtualClock

        public SimpleVirtualClock​(double speed,
                                  deltix.qsrv.hf.pub.TimeSource baseTimeSource)
    • Method Detail

      • currentTimeMillis

        public long currentTimeMillis()
        Specified by:
        currentTimeMillis in interface deltix.qsrv.hf.pub.TimeSource
        Returns:
        current virtual time
      • getVirtualTimeFromRealTime

        public long getVirtualTimeFromRealTime​(long currentRealTime)
      • resetTo

        public void resetTo​(long startingVirtualTimestamp)
        Sets current virtual clock time to a specific timestamp.
      • setSpeed

        public void setSpeed​(double speed)
      • pause

        public boolean pause()
      • resume

        public boolean resume()
      • isPaused

        public boolean isPaused()
      • getSpeed

        public double getSpeed()
        Returns:
        configured speed (may be non 0 even if paused)
      • isTimeRunning

        public boolean isTimeRunning()
        Returns:
        true if clock is not stopped (due to pause or zero speed)