Code example for AtomicLong

0
class ManualClock implements Clock { 
 
    private final AtomicLong time;
 
    ManualClock(long init) {
        time = new AtomicLong(init);
    } 
 
    void set(long t) {
        time.set(t);
    } 
 
    public long now() { 
        return time.get();
    } 
}