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

TimeUnit coversions do not round off

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Seems like all versions

      A DESCRIPTION OF THE PROBLEM :
      assertEquals(1,TimeUnit.MILLISECONDS.toSeconds(999));
      Expected :1
      Actual :0

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      TimeUnit.MILLISECONDS.toSeconds(999)


      ---------- BEGIN SOURCE ----------
      import java.util.concurrent.TimeUnit;
      import org.junit.jupiter.api.Test;


      class AppTests {

      @Test
      void contextLoads() {
      //default test case to show that spring is not broken
      assertEquals(1,TimeUnit.MILLISECONDS.toSeconds(999));
      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      divide by 1000.0

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: