@Test public void testFastClock() { TimeWarpedClock clock = new TimeWarpedClock(10); Stopwatch stopwatch = new Stopwatch(clock); stopwatch.resetIfNotInit(); try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } assertEquals(50, stopwatch.pop(), 15); }
@Override public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException { Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier)); }
TimeWarpedClock implements Clock { @Override public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException { Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier)); } }
TimeWarpedClock implements Clock { @Override public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException { Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier)); } TimeWarpedClock(double speedMultiplier, long startTime);  TimeWarpedClock(double speedMultiplier); }
TimeWarpedClock implements Clock { @Override public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException { Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier)); } TimeWarpedClock(double speedMultiplier, long startTime);  TimeWarpedClock(double speedMultiplier); double getSpeed(); long getStartTime(); @Override long getTime(); @Override void scheduleAt(long millis, Runnable runnable); @Override void sleep(long dt, TimeUnit timeUnit); }
TimeWarpedClock implements Clock { @Override public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException { Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier)); } TimeWarpedClock(double speedMultiplier, long startTime);  TimeWarpedClock(double speedMultiplier); double getSpeed(); long getStartTime(); @Override long getTime(); @Override void scheduleAt(long millis, Runnable runnable); @Override void sleep(long dt, TimeUnit timeUnit);  }