mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 03:24:59 +00:00
Merge pull request #122 from alesgenova/fix-year-2067
fix int32 overflow when setting a year past 2067
This commit is contained in:
commit
fe1c024e47
@ -46,7 +46,7 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
|
||||
current_offset = movement_get_current_timezone_offset_for_zone(movement_get_timezone_index());
|
||||
return;
|
||||
case 0: // year
|
||||
date_time.unit.year = ((date_time.unit.year % 60) + 1);
|
||||
date_time.unit.year = (date_time.unit.year + 1) % 60;
|
||||
break;
|
||||
case 1: // month
|
||||
date_time.unit.month = (date_time.unit.month % 12) + 1;
|
||||
|
||||
@ -205,7 +205,8 @@ uint32_t watch_utility_date_time_to_unix_time(watch_date_time_t date_time, int32
|
||||
watch_date_time_t watch_utility_date_time_from_unix_time(uint32_t timestamp, int32_t utc_offset) {
|
||||
watch_date_time_t retval;
|
||||
retval.reg = 0;
|
||||
int32_t days, secs;
|
||||
uint32_t secs;
|
||||
int32_t days;
|
||||
int32_t remdays, remsecs, remyears;
|
||||
int32_t qc_cycles, c_cycles, q_cycles;
|
||||
int32_t years, months;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user