check that last update is later than now
authorjasu <jasu@skeletor.(none)>
Sun, 23 May 2010 10:16:25 +0000 (13:16 +0300)
committerjasu <jasu@skeletor.(none)>
Sun, 23 May 2010 10:16:25 +0000 (13:16 +0300)
src/widget.cpp

index a6694fd..0f41be0 100644 (file)
@@ -174,10 +174,12 @@ void Widget::trainingLoaded()
             m_updateTimer->stop();
 
         QDateTime nextUpdate = m_training->lastTraining().endTime;
-        nextUpdate.addSecs(-1*60*60*24);
-        m_updateTimer->setInterval(1000 * (m_training->currentTime.secsTo(nextUpdate) + 15));
-        m_updateTimer->start();
 
+        nextUpdate.addSecs(-1*60*60*24);
+        if (nextUpdate > m_training->currentTime) {
+            m_updateTimer->setInterval(1000 * (m_training->currentTime.secsTo(nextUpdate) + 15));
+            m_updateTimer->start();
+        }
     }
     update();
 }