clock/clockmw/clocktimezone/src/timezoneclient.cpp
changeset 83 5aadd1120515
parent 57 bb2d3e476f29
equal deleted inserted replaced
82:dcd0ca396fa1 83:5aadd1120515
   997 
   997 
   998 	const int ruleCount( vActualisedRules->Count() );
   998 	const int ruleCount( vActualisedRules->Count() );
   999 	int ruleMatchIndex( KNoDifference );
   999 	int ruleMatchIndex( KNoDifference );
  1000 
  1000 
  1001 	TTimeIntervalSeconds secondsDifference;
  1001 	TTimeIntervalSeconds secondsDifference;
  1002 	TTime ruleMatchTime;
       
  1003 
  1002 
  1004 	// Fetch lowest time offset for the year residing at aTime.
  1003 	// Fetch lowest time offset for the year residing at aTime.
  1005 	// This is used to determine if DST is on.
  1004 	// This is used to determine if DST is on.
  1006 	for ( int ruleIndex( FALSE ); ruleIndex < ruleCount; ++ruleIndex ) {
  1005 	for ( int ruleIndex( FALSE ); ruleIndex < ruleCount; ++ruleIndex ) {
  1007 		const TVTzActualisedRule& actualisedRule =
  1006 		const TVTzActualisedRule& actualisedRule =
  1046 			TDateTime sevenDays(FALSE, EJanuary, KDaysInWeek, FALSE, FALSE,
  1045 			TDateTime sevenDays(FALSE, EJanuary, KDaysInWeek, FALSE, FALSE,
  1047 							FALSE, FALSE);
  1046 							FALSE, FALSE);
  1048 			TTime tempTime( sevenDays );
  1047 			TTime tempTime( sevenDays );
  1049 			TTime newTime( ruleTime.Int64() + tempTime.Int64() );
  1048 			TTime newTime( ruleTime.Int64() + tempTime.Int64() );
  1050 
  1049 
  1051 			TTimeIntervalDays temp;
       
  1052 			temp = newTime.DaysFrom( ruleTime );
       
  1053 
       
  1054 			if ( ( secondsDifference.Int() >= KNoDifference ) &&
  1050 			if ( ( secondsDifference.Int() >= KNoDifference ) &&
  1055 					( newTime > alarmTime) &&
  1051 					( newTime > alarmTime) &&
  1056 					( actualisedRule.iTimeOfChange < alarmTime ) &&
  1052 					( actualisedRule.iTimeOfChange < alarmTime ) &&
  1057 					( ruleTime < actualisedRule.iTimeOfChange ) ) {
  1053 					( ruleTime < actualisedRule.iTimeOfChange ) ) {
  1058 				// If there is a match, save the index and break.
  1054 				// If there is a match, save the index and break.
  1059 				// We've got the rule and there's no need to continue with other rules.
  1055 				// We've got the rule and there's no need to continue with other rules.
  1060 				ruleMatchIndex = ruleIndex;
  1056 				ruleMatchIndex = ruleIndex;
  1061 				ruleMatchTime = actualisedRule.iTimeOfChange;
       
  1062 				break;
  1057 				break;
  1063 			}
  1058 			}
  1064 		}
  1059 		}
  1065 	}
  1060 	}
  1066 
  1061