actually, set the time after loading settings (need to convert to UTC)
This commit is contained in:
parent
32086bc499
commit
29547227ee
28
movement.c
28
movement.c
@ -572,15 +572,6 @@ void app_init(void) {
|
||||
|
||||
filesystem_init();
|
||||
|
||||
watch_date_time_t date_time = watch_rtc_get_date_time();
|
||||
if (date_time.reg == 0) {
|
||||
// at first boot, set year to 2025
|
||||
date_time.unit.year = 2025 - WATCH_RTC_REFERENCE_YEAR;
|
||||
date_time.unit.month = 1;
|
||||
date_time.unit.day = 1;
|
||||
watch_rtc_set_date_time(date_time);
|
||||
}
|
||||
|
||||
// check if we are plugged into USB power.
|
||||
HAL_GPIO_VBUS_DET_in();
|
||||
HAL_GPIO_VBUS_DET_pulldown();
|
||||
@ -639,6 +630,22 @@ void app_init(void) {
|
||||
|
||||
movement_store_settings();
|
||||
}
|
||||
|
||||
// populate the DST offset cache
|
||||
_movement_update_dst_offset_cache();
|
||||
|
||||
watch_date_time_t date_time = watch_rtc_get_date_time();
|
||||
if (date_time.reg == 0) {
|
||||
// at first boot, set year to 2025
|
||||
date_time.unit.year = 2025 - WATCH_RTC_REFERENCE_YEAR;
|
||||
date_time.unit.month = 1;
|
||||
date_time.unit.day = 1;
|
||||
// but convert from local time to UTC
|
||||
date_time = watch_utility_date_time_convert_zone(date_time, movement_get_current_timezone_offset(), 0);
|
||||
watch_rtc_set_date_time(date_time);
|
||||
}
|
||||
|
||||
|
||||
movement_state.light_ticks = -1;
|
||||
movement_state.alarm_ticks = -1;
|
||||
movement_state.next_available_backup_register = 2;
|
||||
@ -664,9 +671,6 @@ void app_setup(void) {
|
||||
is_first_launch = false;
|
||||
}
|
||||
|
||||
// populate the DST offset cache
|
||||
_movement_update_dst_offset_cache();
|
||||
|
||||
#if __EMSCRIPTEN__
|
||||
int32_t time_zone_offset = EM_ASM_INT({
|
||||
return -new Date().getTimezoneOffset();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user