diff --git a/src/main/java/org/elasticsearch/watcher/support/clock/SystemClock.java b/src/main/java/org/elasticsearch/watcher/support/clock/SystemClock.java index d6314138d9b..eee9328c6db 100644 --- a/src/main/java/org/elasticsearch/watcher/support/clock/SystemClock.java +++ b/src/main/java/org/elasticsearch/watcher/support/clock/SystemClock.java @@ -47,7 +47,7 @@ public final class SystemClock implements Clock { @Override public TimeValue timeElapsedSince(DateTime time) { - return TimeValue.timeValueMillis(System.currentTimeMillis() - time.getMillis()); + return TimeValue.timeValueMillis(millis() - time.getMillis()); } } diff --git a/src/test/java/org/elasticsearch/watcher/actions/throttler/ActionThrottleTests.java b/src/test/java/org/elasticsearch/watcher/actions/throttler/ActionThrottleTests.java index 4e4bd139134..b9c8a8c7f30 100644 --- a/src/test/java/org/elasticsearch/watcher/actions/throttler/ActionThrottleTests.java +++ b/src/test/java/org/elasticsearch/watcher/actions/throttler/ActionThrottleTests.java @@ -54,11 +54,6 @@ import static org.hamcrest.Matchers.greaterThan; */ public class ActionThrottleTests extends AbstractWatcherIntegrationTests { - @Override - protected boolean timeWarped() { - return true; - } - @Test @Slow @Repeat(iterations = 10) public void testSingleActionAckThrottle() throws Exception { boolean useClientForAcking = randomBoolean(); diff --git a/src/test/java/org/elasticsearch/watcher/support/clock/ClockMock.java b/src/test/java/org/elasticsearch/watcher/support/clock/ClockMock.java index 94be212370b..f433053cb70 100644 --- a/src/test/java/org/elasticsearch/watcher/support/clock/ClockMock.java +++ b/src/test/java/org/elasticsearch/watcher/support/clock/ClockMock.java @@ -7,7 +7,6 @@ package org.elasticsearch.watcher.support.clock; import org.elasticsearch.common.joda.time.DateTime; import org.elasticsearch.common.joda.time.DateTimeZone; -import org.elasticsearch.common.joda.time.Duration; import org.elasticsearch.common.unit.TimeValue; import java.util.concurrent.TimeUnit; @@ -46,7 +45,7 @@ public class ClockMock implements Clock { @Override public TimeValue timeElapsedSince(DateTime time) { - return TimeValue.timeValueMillis(new Duration(time, now).getMillis()); + return TimeValue.timeValueMillis(now.getMillis() - time.getMillis()); } public ClockMock setTime(DateTime now) {