Fix for bug 2719.
authorteknolog
Wed, 26 May 2010 10:44:32 +0100
changeset 131 87e863f6f840
parent 126 c2f1ea38ec70
child 132 3903521a36da
Fix for bug 2719.
engine/inc/FeedTimer.h
engine/src/FeedTimer.cpp
--- a/engine/inc/FeedTimer.h	Thu May 13 13:56:05 2010 +0100
+++ b/engine/inc/FeedTimer.h	Wed May 26 10:44:32 2010 +0100
@@ -36,6 +36,7 @@
 	
 	private:
 		TInt iPeriodMinutes;
+		TTime iTriggerTime;
 		CFeedEngine *iFeedEngine;
 	};
 #endif
--- 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);
 	}