Readds leap year checks (#2)
This commit is contained in:
@@ -51,7 +51,7 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
|
||||
date_time.unit.month = (date_time.unit.month % 12) + 1;
|
||||
break;
|
||||
case 3: { // day
|
||||
date_time.unit.day = date_time.unit.day + 1;
|
||||
date_time.unit.day = (date_time.unit.day % watch_utility_days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR)) + 1;
|
||||
break;
|
||||
case 4: // hour
|
||||
date_time.unit.hour = (date_time.unit.hour + 1) % 24;
|
||||
@@ -64,8 +64,6 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
|
||||
date_time.unit.day = 1;
|
||||
movement_set_local_date_time(date_time);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user