title: Android Java handler.postDelayed() remainingTime returns wrong value
body: <p>I want to be able to calculate remaining time of <code>myHandler2.postDelayed()</code>. I was using this <a href="https://stackoverflow.com/a/25285623/14992173">answer</a> but it returns wrong value. Here is my code where the startTime variable is:</p>
  <pre><code>public void attackOnChibi(ChibiCharacter cc, boolean able) {
  
      runnable = () -&gt; {
          Log.i(&quot;a&quot;, &quot;a&quot;);
      };
  
      if (able) {
          startTime = System.nanoTime();
          myHandler2.postDelayed(runnable, count += 2000);
      }
      if (!able) {
          myHandler2.removeCallbacksAndMessages(null);
          count = 0;
      }
  }
  </code></pre>
  <p>And the code when I calculates and displays this remaining time:</p>
  <pre><code>        elapsedTime = System.nanoTime() - gs.enemies.get(gs.enemyId - 1).startTime;
          remainingTime = gs.enemies.get(gs.enemyId - 1).count + 2000 - TimeUnit.MILLISECONDS.convert(elapsedTime, TimeUnit.NANOSECONDS);
          Log.i(&quot;elapsed/remaining&quot;, elapsedTime + &quot; &quot; + remainingTime);
  </code></pre>
  <p>Why it does not work? Help me please...</p>