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

Duration.toString violates specification

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b101
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      In the JavaDoc, for Duration.toString, it is specified that the "hours, minutes and seconds will all have the same sign". However, this is violated in certain cases. For instance, while Duration.ofSeconds(-59, 100000000) correctly prints as "PT-58.9S", Duration.ofSeconds(-60, 100000000) prints as "PT-1M0.1S" with a negative minute, but a positive second, when "PT-59.9S" would be the expected result.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              ntv Nadeesh Tv
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: