The timezone now auto-corrects with DST (but still displays the same offset in the settings screen to the user)

This commit is contained in:
David Volovskiy
2024-08-02 01:25:01 -04:00
parent 149911e4ad
commit 4c546b14dc
22 changed files with 75 additions and 98 deletions

View File

@@ -165,6 +165,7 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
uint32_t timestamp;
uint32_t previous_date_time;
watch_date_time date_time;
int16_t tz;
switch (event.event_type) {
case EVENT_ACTIVATE:
@@ -183,8 +184,9 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
/* Determine current time at time zone and store date/time */
date_time = watch_rtc_get_date_time();
timestamp = watch_utility_date_time_to_unix_time(date_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
date_time = watch_utility_date_time_from_unix_time(timestamp, movement_timezone_offsets[state->current_zone] * 60);
tz = get_timezone_offset(settings->bit.time_zone, date_time);
timestamp = watch_utility_date_time_to_unix_time(date_time, tz * 60);
date_time = watch_utility_date_time_from_unix_time(timestamp, tz * 60);
previous_date_time = state->previous_date_time;
state->previous_date_time = date_time.reg;
@@ -284,7 +286,7 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings,
watch_clear_indicator(WATCH_INDICATOR_PM);
refresh_face = false;
}
result = div(movement_timezone_offsets[state->current_zone], 60);
result = div(get_timezone_offset(state->current_zone, watch_rtc_get_date_time()), 60);
hours = result.quot;
minutes = result.rem;