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

Add TimeUnit#convert(Duration)

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None

      Backports

        Description

        Converting from Duration to TimeUnit is surprisingly difficult to get right (if we want saturating behavior on overflow, which we almost always want in java.util.concurrent), and should be provided to encourage users to store durations in Durations.

        If users want ArithmeticException on overflow, then e.g. the existing Duration#toNanos should suffice.

        https://openjdk.markmail.org/thread/ndcwjnmbpwhkvkwe

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  martin Martin Buchholz
                  Reporter:
                  martin Martin Buchholz
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: