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

(timer) Repeated task stops working when the time is moved backward

XMLWordPrintable

    • x86_64
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      / macOS High Sierra v.10.13.5 / Java v.1.8.0_162-b12

      A DESCRIPTION OF THE PROBLEM :
      - If I modify the time of my computer and I set a minor time compared to the current time, the task stop working.
      - If I modify the time of my computer and I set a major time compared to the current time, the task continue working as well.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Copy and paste the provided code and execute it
      2. Now change the time of your computer with a minor time (for example from 18:19:26 to 15:19:26)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The software should continue printing numbers. This is a real problem when the daylight savings time arrives (summer/winter).
      ACTUAL -
      The program stops printing numbers

      ---------- BEGIN SOURCE ----------
      Timer timer = new Timer();
      TimerTask timertask = new TimerTask() {
          @Override
          public void run() {
              System.out.println(ThreadLocalRandom.current().nextInt(0, 1000));
          }
      };
      timer.schedule(timertask, 0, 1000);
      ---------- END SOURCE ----------

      FREQUENCY : always


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

              Created:
              Updated:
              Resolved: