diff --git a/core/src/main/java/com/google/bitcoin/core/Utils.java b/core/src/main/java/com/google/bitcoin/core/Utils.java index b91a0981..bdb7f99a 100644 --- a/core/src/main/java/com/google/bitcoin/core/Utils.java +++ b/core/src/main/java/com/google/bitcoin/core/Utils.java @@ -482,14 +482,19 @@ public class Utils { return new Date(); } - /** Returns the current time in seconds since the epoch, or a mocked out equivalent. */ + // TODO: Replace usages of this where the result is / 1000 with currentTimeSeconds. + /** Returns the current time in milliseconds since the epoch, or a mocked out equivalent. */ public static long currentTimeMillis() { if (mockTime != null) return mockTime.getTime(); else return System.currentTimeMillis(); } - + + public static long currentTimeSeconds() { + return currentTimeMillis() / 1000; + } + public static byte[] copyOf(byte[] in, int length) { byte[] out = new byte[length]; System.arraycopy(in, 0, out, 0, Math.min(length, in.length));