markt-asf commented on code in PR #751:
URL: https://github.com/apache/tomcat/pull/751#discussion_r1754134779


##########
java/org/apache/tomcat/util/http/FastHttpDateFormat.java:
##########
@@ -105,7 +105,7 @@ public final class FastHttpDateFormat {
     public static String getCurrentDate() {
         long now = System.currentTimeMillis();
         // Handle case where time moves backwards (e.g. system time corrected)
-        if (Math.abs(now - currentDateGenerated) > 1000) {
+        if (now - now%1000L != currentDateGenerated - 
currentDateGenerated%1000L) {

Review Comment:
   There are faster ways of achieving the same results. This adds ~ 9% to 
getCurrentDate(). Look as dividing now by 1000 instead.



##########
test/org/apache/tomcat/util/http/TesterFastHttpDateFormat.java:
##########
@@ -0,0 +1,48 @@
+package org.apache.tomcat.util.http;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TesterFastHttpDateFormat {

Review Comment:
   This needs to be called `TestFastHttpDateFormat` so it gets included in 
standard test runs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to