mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
Add a Utils.currentTimeSeconds method with a TODO to convert other usages over
This commit is contained in:
parent
a31010b379
commit
6c5e1344ba
@ -482,7 +482,8 @@ public class Utils {
|
|||||||
return new Date();
|
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() {
|
public static long currentTimeMillis() {
|
||||||
if (mockTime != null)
|
if (mockTime != null)
|
||||||
return mockTime.getTime();
|
return mockTime.getTime();
|
||||||
@ -490,6 +491,10 @@ public class Utils {
|
|||||||
return System.currentTimeMillis();
|
return System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long currentTimeSeconds() {
|
||||||
|
return currentTimeMillis() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] copyOf(byte[] in, int length) {
|
public static byte[] copyOf(byte[] in, int length) {
|
||||||
byte[] out = new byte[length];
|
byte[] out = new byte[length];
|
||||||
System.arraycopy(in, 0, out, 0, Math.min(length, in.length));
|
System.arraycopy(in, 0, out, 0, Math.min(length, in.length));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user