package net.time4tea.time.test;

import net.time4tea.time.Clock;

import java.time.Duration;
import java.time.ZonedDateTime;
import java.util.concurrent.atomic.AtomicReference;

public class TickingClock implements Clock {

    private final AtomicReference<ZonedDateTime> now;

    public TickingClock(ZonedDateTime startTime) {
        now = new AtomicReference<>(startTime);
    }

    @Override
    public ZonedDateTime now() {
        return now.get();
    }

    public static TickingClock atUTC(String yymmddhhmmssSSS) {
        return new TickingClock(Dates.utc(yymmddhhmmssSSS));
    }

    public void tick(Duration duration) {
        now.set(
                now.get().plus(duration)
        );
    }
}

@@ -121,60 +121,8 @@
 ime;
-%0Aimport java.util.concurrent.atomic.AtomicReference;
 %0A%0Apu
@@ -181,30 +181,8 @@
 ate 
-final AtomicReference%3C
 Zone
@@ -190,17 +190,16 @@
 DateTime
-%3E
  now;%0A%0A 
@@ -266,30 +266,8 @@
 w = 
-new AtomicReference%3C%3E(
 star
@@ -271,17 +271,16 @@
 tartTime
-)
 ;%0A    %7D%0A
@@ -345,22 +345,16 @@
 turn now
-.get()
 ;%0A    %7D%0A
@@ -542,39 +542,14 @@
  now
-.set(%0A                now.get()
+ = now
 .plu
@@ -563,18 +563,8 @@
 ion)
-%0A        )
 ;%0A  

remove threaded stuff