engine/src/FeedTimer.cpp
changeset 96 87e863f6f840
parent 2 29cda98b007e
--- a/engine/src/FeedTimer.cpp	Thu May 13 13:56:05 2010 +0100
+++ b/engine/src/FeedTimer.cpp	Wed May 26 10:44:32 2010 +0100
@@ -35,13 +35,26 @@
 
 void CFeedTimer::RunL() 
 	{
-	DP("CFeedTimer::RunL");
+	DP("CFeedTimer::RunL BEGIN");
+
+	TTime time;
+	time.UniversalTime();
 
-	// We need to trap this, otherwise we will not reschedule the timer
-	TRAP_IGNORE(iFeedEngine->UpdateAllFeedsL(ETrue));
-
-	// run again
-	RunPeriodically();
+	if (time < iTriggerTime)
+		{
+		// timer was probably reset, this happens on Nokia every 30 minutes
+		DP("Timer reset");
+		AtUTC(iTriggerTime);
+		}
+	else 
+		{
+		// We need to trap this, otherwise we will not reschedule the timer
+		TRAP_IGNORE(iFeedEngine->UpdateAllFeedsL(ETrue));
+	
+		// run again
+		RunPeriodically();
+		}
+	DP("CFeedTimer::RunL END");
 	}
 
 void CFeedTimer::SetPeriod(TInt aPeriodMinutes) 
@@ -93,8 +106,8 @@
 
 	TTimeIntervalMinutes tmi;
 	tmi = iPeriodMinutes;
-	time = time + tmi;
+	iTriggerTime = time + tmi;
 	DP("Running timer");
 
-	AtUTC(time);
+	AtUTC(iTriggerTime);
 	}