title: Qt: How to implement "per minute" Timer? Better option to avoid misfire and double-fire?
body: <p>I am using Qt5 on Windows7 platform.<br>
  In my current app I need a timer to fire every minute ("per minute"), from minute 00 to 59...<br>
  I have experimented various ideas, but my (previous) solutions had some issues like: misfire (no timeout triggered for a certain minute) or double-fire (timeout triggered twice for the same minute!).<br>
  Finally, I currently reached to this implementation:   </p>
  
  <pre><code>static QTimer timer;
  
  static int GetInterval()
  {
      QDateTime now(QDateTime::currentDateTime());
      return ((60 - now.time().second()) * 1000 - now.time().msec());
  }
  
  void TEST_TIMER(void)
  {
      QObject::connect(&amp;timer, &amp;QTimer::timeout, []()
      {
      qDebug() &lt;&lt; " Triggered! " &lt;&lt; QDateTime::currentDateTime().time().minute()
                                 &lt;&lt; QDateTime::currentDateTime().time().second()
                                 &lt;&lt; QDateTime::currentDateTime().time().msec();
          timer.start(GetInterval());
      } );
      timer.start(GetInterval());
  }    
  </code></pre>
  
  <p>And here is the output:   </p>
  
  <pre><code> Triggered!  34 59 550
   Triggered!  35 0 3
   Triggered!  36 0 15
   Triggered!  37 0 28
   Triggered!  38 0 41
   Triggered!  39 0 54
   Triggered!  40 0 68
   Triggered!  41 0 82
   Triggered!  42 0 97
   Triggered!  43 0 109
   Triggered!  44 0 123
   Triggered!  45 0 137
   Triggered!  46 0 149
   Triggered!  47 0 165
   Triggered!  48 0 178
   Triggered!  49 0 192
   Triggered!  50 0 205
   Triggered!  51 0 217
   Triggered!  52 0 231
   Triggered!  53 0 244
       ...   
  </code></pre>
  
  <p>Seems ok, <strong>except the first line:</strong> <code>Triggered!  34 59 550</code> :( <strong>Why?</strong><br>
  Also, <strong>why</strong> is there that up-drift of about 12-13 msecs/minute?.<br>
  So, not being expert in this matter I prefer to ask:<br>
  Is this implementation ok? Can it be improved to avoid unpleasant situations like double-fire and/or misfire? </p>