Systronix_utilities.cpp
// NOTE: for the local_to_utc() conversion, any time 02:00:00 to 02:59:59 on dst start date is an error that we
// don't catch.  We presume that it is unlikely that user's will be setting the habitat clocks at that time of
// the morning.
for the local_to_utc() conversion, any time 02:00:00 to 02:59:59 on dst start date is an error that we
don't catch.  We presume that it is unlikely that user's will be setting the habitat clocks at that time of
the morning.
for the local_to_utc () conversion any time 02 : 00 : 00 to 02 : 59 : 59 on dst start date is an error that we don ' t catch . We presume that it is unlikely that user ' s will be setting the habitat clocks at that time of the morning .
boolean Systronix_utilities::is_dst (uint16_t year, uint8_t month, uint8_t day, int8_t hour, boolean has_adjustment)
	{
	uint8_t dst_start [] = {8, 14, 13, 12, 11, 10, 9};	
	uint8_t date_of_dst_start, date_of_dst_end;
	date_of_dst_start = dst_start [_day_of_week (year, 3, 0x01)];	
	date_of_dst_end = dst_start [_day_of_week (year, 11, 0x01)] - 7;	
	if (3 == month)					
		{
		if (day < date_of_dst_start)
			return false;			
		if (day > date_of_dst_start)
			return true;			
		if ((day == date_of_dst_start) && (hour >= 2))
			return true;			
		return false;				
		}
	if (11 == month)				
		{
		if (day < date_of_dst_end)
			return true;			
		if (day > date_of_dst_end)
			return false;			
		if ((day == date_of_dst_end) && (hour >= (has_adjustment ? 2 : 1)))	
			return false;			
		return true;				
		}
	if ((month > 3) && (month < 11))
		return true;				
		return false;				
	}
boolean Systronix_utilities :: is_dst ( uint16_t year , uint8_t month , uint8_t day , int8_t hour , boolean has_adjustment ) { uint8_t dst_start [ ] = { 8 , 14 , 13 , 12 , 11 , 10 , 9 } ; uint8_t date_of_dst_start , date_of_dst_end ; date_of_dst_start = dst_start [ _day_of_week ( year , 3 , 0x01 ) ] ; date_of_dst_end = dst_start [ _day_of_week ( year , 11 , 0x01 ) ] - 7 ; if ( 3 == month ) { if ( day < date_of_dst_start ) return false ; if ( day > date_of_dst_start ) return true ; if ( ( day == date_of_dst_start ) && ( hour >= 2 ) ) return true ; return false ; } if ( 11 == month ) { if ( day < date_of_dst_end ) return true ; if ( day > date_of_dst_end ) return false ; if ( ( day == date_of_dst_end ) && ( hour >= ( has_adjustment ? 2 : 1 ) ) ) return false ; return true ; } if ( ( month > 3 ) && ( month < 11 ) ) return true ; return false ; }
NOTE: for the local_to_utc() conversion, any time 02:00:00 to 02:59:59 on dst start date is an error that we
don't catch.
NOTE : for the local_to_utc () conversion any time 02 : 00 : 00 to 02 : 59 : 59 on dst start date is an error that we don ' t catch .
// Sunday, Monday, ..., Saturday // figure dst start date // figure dst end date // march // isn't yet date of dst start // dst has already started // dst starts today and has already started // dst starts today but hasn't yet started (00:00:00 -> 01:59:59) // november // isn't yet date of dst end // dst has already ended // time/date comparison is in local time with or without adjustment // dst ends today and has already ended // dst ends today but hasn't yet ended  (00:00:00 -> 00:59:59 standard time) // in DST //	if ((month < 3) || (month > 11)) // in standard time