commit c3749fb4e0092db33fccaab4352d78fa3d1b4783 Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Sep 5 15:18:54 2017 +0200
Use a constant for milliseconds in a day. --- src/main/java/org/torproject/exonerator/QueryServlet.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/torproject/exonerator/QueryServlet.java b/src/main/java/org/torproject/exonerator/QueryServlet.java index 903c9d2..74be053 100644 --- a/src/main/java/org/torproject/exonerator/QueryServlet.java +++ b/src/main/java/org/torproject/exonerator/QueryServlet.java @@ -40,6 +40,8 @@ public class QueryServlet extends HttpServlet {
private DataSource ds;
+ private static final long MILLISECONDS_IN_A_DAY = 24L * 60L * 60L * 1000L; + @Override public void init() {
@@ -329,8 +331,8 @@ public class QueryServlet extends HttpServlet { response.firstDateInDatabase = dateFormat.format(allValidAfters.first()); response.lastDateInDatabase = dateFormat.format(allValidAfters.last()); response.relevantStatuses = false; - long timestampFrom = timestamp - 24L * 60L * 60L * 1000L; - long timestampTo = timestamp + 2 * 24L * 60L * 60L * 1000L - 1L; + long timestampFrom = timestamp - MILLISECONDS_IN_A_DAY; + long timestampTo = timestamp + 2 * MILLISECONDS_IN_A_DAY - 1L; for (long validAfter : allValidAfters) { if (validAfter >= timestampFrom && validAfter <= timestampTo) { response.relevantStatuses = true;