engine/src/FeedTimer.cpp
branchsymbian1
changeset 147 2e626f5a52c8
parent 129 7ef9faf10a81
equal deleted inserted replaced
146:78d1b03a94ff 147:2e626f5a52c8
    33 	CTimer::ConstructL();
    33 	CTimer::ConstructL();
    34 	}
    34 	}
    35 
    35 
    36 void CFeedTimer::RunL() 
    36 void CFeedTimer::RunL() 
    37 	{
    37 	{
    38 	DP("CFeedTimer::RunL");
    38 	DP("CFeedTimer::RunL BEGIN");
    39 
    39 
    40 	// We need to trap this, otherwise we will not reschedule the timer
    40 	TTime time;
    41 	TRAP_IGNORE(iFeedEngine->UpdateAllFeedsL(ETrue));
    41 	time.UniversalTime();
    42 
    42 
    43 	// run again
    43 	if (time < iTriggerTime)
    44 	RunPeriodically();
    44 		{
       
    45 		// timer was probably reset, this happens on Nokia every 30 minutes
       
    46 		DP("Timer reset");
       
    47 		AtUTC(iTriggerTime);
       
    48 		}
       
    49 	else 
       
    50 		{
       
    51 		// We need to trap this, otherwise we will not reschedule the timer
       
    52 		TRAP_IGNORE(iFeedEngine->UpdateAllFeedsL(ETrue));
       
    53 	
       
    54 		// run again
       
    55 		RunPeriodically();
       
    56 		}
       
    57 	DP("CFeedTimer::RunL END");
    45 	}
    58 	}
    46 
    59 
    47 void CFeedTimer::SetPeriod(TInt aPeriodMinutes) 
    60 void CFeedTimer::SetPeriod(TInt aPeriodMinutes) 
    48 	{
    61 	{
    49 	DP1("Setting sync period to %d", aPeriodMinutes);
    62 	DP1("Setting sync period to %d", aPeriodMinutes);
    91 	TTime time;
   104 	TTime time;
    92 	time.UniversalTime();
   105 	time.UniversalTime();
    93 
   106 
    94 	TTimeIntervalMinutes tmi;
   107 	TTimeIntervalMinutes tmi;
    95 	tmi = iPeriodMinutes;
   108 	tmi = iPeriodMinutes;
    96 	time = time + tmi;
   109 	iTriggerTime = time + tmi;
    97 	DP("Running timer");
   110 	DP("Running timer");
    98 
   111 
    99 	AtUTC(time);
   112 	AtUTC(iTriggerTime);
   100 	}
   113 	}