diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java index c5aa8dd6aae..cce11cfd6d7 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java @@ -25,6 +25,7 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.Objects; import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.servlet.ReadListener; @@ -146,18 +147,16 @@ public class HttpInput extends ServletInputStream implements Runnable { synchronized (_inputQ) { - long now=System.currentTimeMillis(); - if (_blockingTimeoutAt>=0 && !isAsync()) - _blockingTimeoutAt=now+getHttpChannelState().getHttpChannel().getHttpConfiguration().getBlockingTimeout(); + _blockingTimeoutAt=System.currentTimeMillis()+getHttpChannelState().getHttpChannel().getHttpConfiguration().getBlockingTimeout(); int minRequestDataRate=_channelState.getHttpChannel().getHttpConfiguration().getMinRequestDataRate(); if (minRequestDataRate>0 && _firstByteTimeStamp!=-1) { - long period=now-_firstByteTimeStamp; + long period=System.nanoTime()-_firstByteTimeStamp; if (period>=1000) { - double data_rate = _contentArrived / (0.001*period); + double data_rate = _contentArrived / ((1.0*period)/TimeUnit.SECONDS.toNanos(1)); if (data_rate