You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description System.nanoTime(), as specified in its javadocs, can roll-over.
Because of that, it's wrong to use the < operator between values, as well as Math.min() etc.
This problem has already been reported in CometD, see cometd/cometd#1215.
The whole codebase should be reviewed so that System.nanoTime() is properly used.
The text was updated successfully, but these errors were encountered:
Introduced o.e.j.util.NanoTime class to deal with nanoTimes.
Now NanoTime.now() should be used instead of System.nanoTime(),
and various <unit>elapsed*() methods to calculate elapsed times.
Furthermore, comparing 2 nanoTimes should be done via isBefore(),
rather than using the < operator, which is wrong as specified in
the System.nanoTime() javadocs.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Fixes#8532 - Review System.nanoTime() usages.
Introduced o.e.j.util.NanoTime class to deal with nanoTimes.
Now NanoTime.now() should be used instead of System.nanoTime(),
and various <unit>[elapsed|since|until]() methods to calculate nanoTimes.
Furthermore, comparing 2 nanoTimes should be done via isBefore(),
rather than using the < operator, which is wrong as specified in
the System.nanoTime() javadocs.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty version(s)
10+
Description
System.nanoTime()
, as specified in its javadocs, can roll-over.Because of that, it's wrong to use the
<
operator between values, as well asMath.min()
etc.This problem has already been reported in CometD, see cometd/cometd#1215.
The whole codebase should be reviewed so that
System.nanoTime()
is properly used.The text was updated successfully, but these errors were encountered: