commit 27769183b1d5add69444677a858d27c98144068a Author: Karsten Loesing karsten.loesing@gmx.net Date: Fri Aug 15 11:52:43 2014 +0200
Remove three dependencies on DateTimeHelper. --- .../java/org/torproject/onionoo/server/NodeIndex.java | 13 ++++++++++--- .../org/torproject/onionoo/server/PerformanceMetrics.java | 7 ++++++- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndex.java b/src/main/java/org/torproject/onionoo/server/NodeIndex.java index f2859a5..fbc8896 100644 --- a/src/main/java/org/torproject/onionoo/server/NodeIndex.java +++ b/src/main/java/org/torproject/onionoo/server/NodeIndex.java @@ -1,19 +1,23 @@ package org.torproject.onionoo.server;
+import java.text.SimpleDateFormat; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; +import java.util.TimeZone;
import org.torproject.onionoo.docs.SummaryDocument; -import org.torproject.onionoo.util.DateTimeHelper;
class NodeIndex {
private String relaysPublishedString; public void setRelaysPublishedMillis(long relaysPublishedMillis) { + SimpleDateFormat dateTimeFormat = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + dateTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); this.relaysPublishedString = - DateTimeHelper.format(relaysPublishedMillis); + dateTimeFormat.format(relaysPublishedMillis); } public String getRelaysPublishedString() { return relaysPublishedString; @@ -21,8 +25,11 @@ class NodeIndex {
private String bridgesPublishedString; public void setBridgesPublishedMillis(long bridgesPublishedMillis) { + SimpleDateFormat dateTimeFormat = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + dateTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); this.bridgesPublishedString = - DateTimeHelper.format(bridgesPublishedMillis); + dateTimeFormat.format(bridgesPublishedMillis); } public String getBridgesPublishedString() { return bridgesPublishedString; diff --git a/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java b/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java index 7639580..09a20a2 100644 --- a/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java +++ b/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java @@ -2,6 +2,7 @@ * See LICENSE for licensing information */ package org.torproject.onionoo.server;
+import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -9,6 +10,7 @@ import java.util.HashMap; import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; +import java.util.TimeZone; import java.util.TreeMap; import java.util.TreeSet;
@@ -150,8 +152,11 @@ public class PerformanceMetrics { lastLoggedMillis = time.currentTimeMillis(); } else if (receivedRequestMillis - lastLoggedMillis > LOG_INTERVAL) { + SimpleDateFormat dateTimeFormat = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + dateTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); System.err.println("Request statistics (" - + DateTimeHelper.format(lastLoggedMillis + LOG_INTERVAL) + + dateTimeFormat.format(lastLoggedMillis + LOG_INTERVAL) + ", " + (LOG_INTERVAL / DateTimeHelper.ONE_SECOND) + " s):"); System.err.println(" Total processed requests: " + totalProcessedRequests);
tor-commits@lists.torproject.org