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

Add TimeUnit#convert(Duration)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • None
    • core-libs
    • None

        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

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

                Created:
                Updated:
                Resolved: