Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8069269

(spec) Defect in the System.nanoTime spec

XMLWordPrintable

    • b49

        Spec of the System.nanoTime:
        "To compare two nanoTime values
         long t0 = System.nanoTime();
         ...
         long t1 = System.nanoTime();
        one should use t1 - t0 < 0, not t1 < t0, because of the possibility of numerical overflow."

        Looks like "t1 - t0 < 0, not t1 < t0" would be better to replace with "t0 - t1 < 0, not t0 < t1", because t0 is less then t1.

              bpb Brian Burkhalter
              evotchen Elena Votchennikova (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: