package cucumber.runtime;

public interface StopWatch {
    void start();

    /**
     * @return nanoseconds since start
     */
    long stop();

    StopWatch SYSTEM = new StopWatch() {
        public Long start;

        @Override
        public void start() {
            start = System.nanoTime();
        }

        @Override
        public long stop() {
            Long duration = System.nanoTime() - start;
            start = null;
            return duration;
        }
    };

    public static class Stub implements StopWatch {
        private final long duration;

        public Stub(long duration) {
            this.duration = duration;
        }

        @Override
        public void start() {
        }

        @Override
        public long stop() {
            return duration;
        }
    }
}

@@ -201,18 +201,57 @@
 lic 
+ThreadLocal%3C
 Long
+%3E
  start
+ = new ThreadLocal%3CLong%3E()
 ;%0A%0A 
@@ -314,19 +314,21 @@
    start
- = 
+.set(
 System.n
@@ -336,16 +336,17 @@
 noTime()
+)
 ;%0A      
@@ -450,16 +450,22 @@
  - start
+.get()
 ;%0A      
@@ -479,15 +479,18 @@
 tart
- = 
+.set(
 null
+)
 ;%0A  

make StopWatch thread safe.