-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Martin,
On 2/28/20 04:44, Martin Grigorov wrote: > Chris, > > On Fri, Feb 28, 2020 at 12:20 AM Christopher Schultz > <ch...@christopherschultz.net > <mailto:ch...@christopherschultz.net>> wrote: > > Rémy, > > On 2/27/20 10:49, r...@apache.org <mailto: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 <mailto: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)); > > >> Those are not the same. Request#startTime >> (System.currentTimeMillis) is the milliseconds since Epoch, i.e. >> a complete timestamp. System.nanoTime() is just a relative time >> that could be used to measure duration between two calls but it >> doesn't tell you when exactly a call has happened. Duh. Thanks for the sanity check :) - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5cDmUACgkQHPApP6U8 pFinzQ/9H80fwJ6I/pN5Ikrb3e/SW21kSWkVOkAypYV6EX0NwfIaAhz9KFYJehwS YMj9iodMkhpfpibRg7B3dXlDPfOjsLRRadc2KQS/5/nOyh+YMfkoXpqXz8gL0ltt eFRuUElA691lcAa/3hTsO/Lvw+NCUad/syXkvRBwJUWInmdGMGIZNCpAu2SYfga0 Gz51317tmV83RRSkXLQCc0t1cDTEhzWlv3bo6foe9elT5phGvd80PUAFSMga9RZa 94ee9jbM7QWfk/L/MdSlwiTVNOe4UXjBsFbIvVs1Eqy/4KkBlKwrP3iG7boXlAgm NIHRWEYs0fwDQxk8fSbxoO6nKsgkX+hsySBi43OZhAdDAtK+AKMYyOFOF9QuDVKI sKiobgDy5KA+dCVCI0k/O1DF3JYL0opeKDsOPHryvwcWQgtNXRdYWIiVyp1wHw9z 9MFlEgD4l6ncugKWRL4YzB06KS2YQxVbx+4IxeHPNqBF8PhmwdagHHT2aqXZoz36 fx8ra2q1M5kP+1DNioZ/pgr3Y1aCaWBu6J+qEvCS/UbYGPOTSto3VqcB+edfIaRU Lknc0fshkfR1vYqUg3T//GI0BSlP9eAhf1ThEM0d7usb7mow2+e9AUF3AEERMiXn Zsl0r/i+ZOK8lhiJgvh8/GSEwP1nreCCPvHnpqsVsRXRjF+KZZg= =fnBR -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org