IntentPushTestCommand: attempt to fix negative duration

Change-Id: Ibb09c9079443de536132f492a44769c373531bfa
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
index 3a08d23..c694fed 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
@@ -94,7 +94,7 @@
 
     private IntentService service;
     private CountDownLatch latch;
-    private long start, end;
+    private volatile long start, end;
     private int apps;
     private int intentsPerApp;
     private int appIdBase;
@@ -239,11 +239,14 @@
     private static final EnumSet<IntentEvent.Type> IGNORE_EVENT
             = EnumSet.of(Type.INSTALL_REQ, Type.WITHDRAW_REQ);
     @Override
-    public void event(IntentEvent event) {
+    public synchronized void event(IntentEvent event) {
         Type expected = add ? Type.INSTALLED : Type.WITHDRAWN;
         if (event.type() == expected) {
-            end = event.time();
+            end = Math.max(end, event.time());
             if (latch != null) {
+                if (latch.getCount() == 0) {
+                    log.warn("Latch was already 0 before counting down?");
+                }
                 latch.countDown();
             } else {
                 log.warn("install event latch is null");