diff --git a/trunk/pedo_alg_thre_det2.c b/trunk/pedo_alg_thre_det2.c index b5d731d..c071dd1 100644 --- a/trunk/pedo_alg_thre_det2.c +++ b/trunk/pedo_alg_thre_det2.c @@ -500,8 +500,10 @@ static unsigned long my_sqrt(unsigned long x) ======================================================== */ static u16 calc_hours_spend( u8 year ) { - // 同じ年の内 - if( bcdtob( cal_log_latest.year_bcd ) == year ) + u8 temp_arg_year_bcd = bcdtob( year ); + + // 同じ年の内 + if( cal_log_latest.year_bcd == temp_arg_year_bcd ) { if( now_longhour > last_hour_fny ) { @@ -512,12 +514,12 @@ static u16 calc_hours_spend( u8 year ) return( 0 ); // 同じ時間帯(と、巻き戻り。 どうなっても知らない) } } - else if( cal_log_latest.year_bcd == ( year -1 ) ) + else if( cal_log_latest.year_bcd == ( temp_arg_year_bcd -1 ) ) { // 年をまたいでいるとき return( ( ( 365 + ( is_firstyear(year) ? 1: 0 )) * 24 ) - last_hour_fny + now_longhour ); } - else if( cal_log_latest.year_bcd < year ) + else if( cal_log_latest.year_bcd < temp_arg_year_bcd ) { // 数年放置 return( PEDOMETER_LOG_SIZE +1 );