Revert "[PAN-2950] Use java.time.Clock instead of System.currentTimeMillis()" (#1768)

This reverts commit 814b36e4
The needed chantes to get rid of Instant.now (which is also needed to get rid
of the wall clock dependency) are too deep and intrusive into IBFT to try and
speed patch them in that some APIs require re-work, so in the interst of test
stability this gets sheleved until it is all ready.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This commit is contained in:
Danno Ferrin
2019-07-26 11:53:36 -06:00
committed by GitHub
parent 8128a7c34b
commit 6f52d8bd83
104 changed files with 370 additions and 767 deletions

View File

@@ -17,20 +17,14 @@ import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.temporal.TemporalUnit;
import java.util.function.Supplier;
import com.google.common.base.Suppliers;
public class TestClock extends Clock {
private static final Supplier<Clock> fixedNow =
Suppliers.memoize(() -> Clock.fixed(Instant.now(), ZoneOffset.UTC));
private Instant now = fixedNow.get().instant();
public static Clock fixed() {
return fixedNow.get();
return Clock.fixed(Instant.ofEpochSecond(10_000_000), ZoneId.systemDefault());
}
private Instant now = Instant.ofEpochSecond(24982948294L);
@Override
public ZoneId getZone() {
return ZoneOffset.UTC;