From 3a57310fbe76c626578025265fc50f9a836dd717 Mon Sep 17 00:00:00 2001
From: dev <dev@robertfoss.se>
Date: Wed, 15 Apr 2015 14:42:39 +0000
Subject: [PATCH] SimpleTimer2: Call the 3-arg addPeridicEvenet() from the
 2-arg addPeridicEvenet()

---
 core/java/src/net/i2p/util/SimpleTimer2.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/core/java/src/net/i2p/util/SimpleTimer2.java b/core/java/src/net/i2p/util/SimpleTimer2.java
index d64426f701..cf2c764d62 100644
--- a/core/java/src/net/i2p/util/SimpleTimer2.java
+++ b/core/java/src/net/i2p/util/SimpleTimer2.java
@@ -131,13 +131,15 @@ public class SimpleTimer2 {
      * @param event
      * @param timeoutMs 
      */
-    public void addEvent(final SimpleTimer.TimedEvent event, long timeoutMs) {
+    public void addEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) {
         if (event == null)
             throw new IllegalArgumentException("addEvent null");
 
         new TimedEvent(this, timeoutMs) {
+        	long absTime = System.currentTimeMillis() + timeoutMs;
             @Override
             public void timeReached() {
+            	System.out.println("Event scheduled for: " + absTime + " started at: " + System.currentTimeMillis() + ", diff: " + (System.currentTimeMillis() - absTime));
                 event.timeReached();
             }
         };
@@ -152,17 +154,10 @@ public class SimpleTimer2 {
      * its own rescheduling).
      * 
      * @since 0.9.20
-     * @param delay run the first iteration of this event after delay ms
      * @param timeoutMs run subsequent iterations of this event every timeoutMs ms
      */
     public void addPeriodicEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) {
-        
-        new PeriodicTimedEvent(this, timeoutMs, timeoutMs) {
-            @Override
-            public void timeReached() {
-                event.timeReached();
-            }
-        };
+        addPeriodicEvent(event, timeoutMs, timeoutMs);
     }
     
     /**
-- 
GitLab