check that last update is later than now
[evehomescreen] / 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();
 }