-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Rémy,

On 2/27/20 10:49, r...@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
>
> remm pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/master by this
> push: new 22ad695  Update request start time using nanoTime 22ad695
> is described below
>
> commit 22ad69571c019f4d84ccc522298dddb4f8fa8d70 Author: remm
> <r...@apache.org> AuthorDate: Thu Feb 27 16:49:04 2020 +0100
>
> Update request start time using nanoTime
>
> get/setStartTime are still there, not sure about existing use.
> Another patch round could deprecate them. Also change the access
> log to be the start of the request (a small part of 63286). ---
>
> [snip]
>
> diff --git a/java/org/apache/coyote/AbstractProcessor.java
> b/java/org/apache/coyote/AbstractProcessor.java index
> 254950e..5af3710 100644 ---
> a/java/org/apache/coyote/AbstractProcessor.java +++
> b/java/org/apache/coyote/AbstractProcessor.java @@ -978,6 +978,7 @@
> public abstract class AbstractProcessor extends
> AbstractProcessorLight implement setSocketWrapper(socketWrapper);
> // Setup the minimal request information
> request.setStartTime(System.currentTimeMillis()); +
> request.setStartTimeNanos(System.nanoTime()); // Setup the minimal
> response information response.setStatus(400); response.setError();

Since we are talking about nanoseconds, here, we ARE, by definition,
splitting hairs :)

System.currentTimeMillis() and System.nanoTime() may disagree when you
capture them like this, because [a super-small amount of] time elapses
between the two calls.

Should we instead do:

long nanos = System.nanoTime();
request.setStartTimeNanos(nanos);
request.setStartTime(nanos / 1000000l);

Or maybe:

long nanos = System.nanoTime();
request.setStartTimeNanos(nanos);
request.setStartTime(TimeUnit.NANOSECONDS.toMillis(nanos));

?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5YQJgACgkQHPApP6U8
pFhTeBAAnSpEZcvd99nyNM8rjYaCuXvij+yaKjOWPq0TFoH7mhJGkWGzTeVS0RoX
ONB23CqbhXv2lI9aOcCjlghW7cwvRXCiLU4I6WVZ8fDj2yjPVvEpccNrJLozmuof
DgfCTx/Uc21s0UMkj6maCdxLUfZdGiBNcp7zwURLwanWhzqRfVzna1VwcQNPiws0
eSK4R0YxrzS6Gt6i00+2e9FyqIe2tUL/hrF5/d3Zj9U4P/b17QOeC3FZfgZjdWMY
splxjEBFx+YmgsAV56qx9uePHjtRnnO30WZEz7X8H+7AwENk6kp5qcA38q7WUkrm
HS3EWYQC8W5dEsu7WcBqj3ZqDSpmwwJaZlSDFXh+bqL9AqEBnLutbBsl+49p6mHP
NvvIQ/Q0sCXOhH7y8juB310yDDkKhHsqRbY2cUzK+eHrdSibESqwDLBDR59F5se/
GQKw4J3icMdqxq69vOxfbXQ6R0PxiL984xW/bcvyH7xZt+d166+BtzyUWHX3knxH
zv+0XUjErwIVrmXXTFDyJYNtjQUGULVdAtGqqSu6mQ+lw0Kr/6i9gqAR4/TUL202
zr8drtkAv87UDQvJpEshmoLtq1tXIwBywtKf9XnXSA6Bgbz5kkMf4lbPWbMJdLQP
BhoyiVA3Xcn8WN4RLCVeEqZHd28/6uWjLjvQXFmRIS8at3tYSeE=
=WcID
-----END PGP SIGNATURE-----

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

Reply via email to