mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-25 10:10:32 -06:00
add clock-based temporal binding functions
This commit is contained in:
parent
6a5e9616b9
commit
fea9cce437
@ -0,0 +1,17 @@
|
||||
package io.nosqlbench.virtdata.library.basics.shared.from_long.to_time_types;
|
||||
|
||||
import io.nosqlbench.virtdata.api.annotations.ThreadSafeMapper;
|
||||
|
||||
import java.util.function.LongUnaryOperator;
|
||||
|
||||
/**
|
||||
* Provide the millisecond epoch time as given by <pre>{@code System.currentTimeMillis()}</pre>
|
||||
* CAUTION: This does not produce deterministic test data.
|
||||
*/
|
||||
@ThreadSafeMapper
|
||||
public class CurrentEpochMillis implements LongUnaryOperator {
|
||||
@Override
|
||||
public long applyAsLong(long operand) {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package io.nosqlbench.virtdata.library.basics.shared.from_long.to_time_types;
|
||||
|
||||
import io.nosqlbench.virtdata.api.annotations.ThreadSafeMapper;
|
||||
|
||||
import java.util.function.LongUnaryOperator;
|
||||
|
||||
/**
|
||||
* Provide the elapsed nano time since the process started.
|
||||
* CAUTION: This does not produce deterministic test data.
|
||||
*/
|
||||
@ThreadSafeMapper
|
||||
public class ElapsedNanoTime implements LongUnaryOperator {
|
||||
@Override
|
||||
public long applyAsLong(long operand) {
|
||||
return System.nanoTime();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user