年をまたいでいる場合の経過日数計算の修正

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@85 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
N2614 2010-01-25 07:23:36 +00:00
parent f0291ac8f6
commit 63580485f6

View File

@ -198,7 +198,6 @@ static void hosu_increment()
last_hour = HOUR; // 履歴読み出し時に使用。BCDのままでよい last_hour = HOUR; // 履歴読み出し時に使用。BCDのままでよい
last_day = DAY; last_day = DAY;
last_month = MONTH; last_month = MONTH;
last_year = YEAR;
now_hour = get_long_hour(); now_hour = get_long_hour();
// RWAIT = 0; ↑で行っています // RWAIT = 0; ↑で行っています
// EI(); 〃 // EI(); 〃
@ -214,7 +213,7 @@ static void hosu_increment()
else if( last_year == ( now_year -1 ) ) else if( last_year == ( now_year -1 ) )
{ {
// 年をまたいでいるとき // 年をまたいでいるとき
u16 temp_hours = ( ( 365 + (( now_year & 0x03 ) == 1 )? 1: 0 ) * 24 ) - last_hour_fny + now_hour; u16 temp_hours = ( ( 365 + (( now_year & 0x03 ) == 1 ? 1: 0 )) * 24 ) - last_hour_fny + now_hour;
fill_hosu_hist_hours( temp_hours ); fill_hosu_hist_hours( temp_hours );
} }
else if( last_year < now_year ) else if( last_year < now_year )
@ -301,7 +300,7 @@ u8 hosu_read( )
case( 3 ): case( 3 ):
hosu_read_state += 1; hosu_read_state += 1;
return( last_year ); return( btobcd(last_year) );
case( 4 ): case( 4 ):
hosu_read_state += 1; hosu_read_state += 1;
@ -490,7 +489,7 @@ u16 get_long_hour()
// 閏年で、閏日より後 // 閏年で、閏日より後
long_hour += 1; long_hour += 1;
} }
long_hour += day_hex; long_hour += day_hex - 1;
long_hour *= 24; // 日数→時間 long_hour *= 24; // 日数→時間
long_hour += hour_hex; long_hour += hour_hex;