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

Inappropriate uses of os::javaTimeMillis()

    XMLWordPrintable

Details

    • b08

    Description

      There are various places that use os::javaTimeMillis() to calculate durations which are used for various purposes. It looks like a convenient way to get the current time in milliseconds. Unfortunately, it is (by definition) subject to external clock adjustment, making it unsuitable for most such duration calculations. (Indeed, there are several comments about it not being used because it doesn't guarantee monotonicity.) It should probably (almost) never be used for such interval calculations. Some of the current uses may be actual lurking bugs, where some timeout may either expire too early or possibly really, really late (for example, if an interval is negative because of clock adjustment).

      Attachments

        Issue Links

          Activity

            People

              dholmes David Holmes
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: