DateTime lib refactor fixes

This commit is contained in:
Willy-JL
2024-02-15 23:08:16 +00:00
parent 2b8db657e4
commit 9656fa319e
10 changed files with 11 additions and 22 deletions

View File

@@ -206,7 +206,7 @@ static void subghz_scene_add_to_history_callback(
const char* suf = subghz->last_settings->protocol_file_names ?
decoder_base->protocol->name :
SUBGHZ_APP_FILENAME_PREFIX;
FuriHalRtcDateTime time = subghz_history_get_datetime(history, idx);
DateTime time = subghz_history_get_datetime(history, idx);
name_generator_make_detailed_datetime(file, sizeof(file), suf, &time, true);
// Dir name
FuriString* path = furi_string_alloc_set(SUBGHZ_APP_FOLDER "/Autosave");
@@ -493,7 +493,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
subghz->threshold_rssi, subghz_txrx_radio_device_get_rssi(subghz->txrx));
if(subghz->last_settings->gps_baudrate != 0) {
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;

View File

@@ -10,7 +10,7 @@ void subghz_scene_saved_show_gps_draw_satellites(void* context) {
subghz_txrx_get_latitude_and_longitude(subghz->txrx, lat_str, lon_str);
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;

View File

@@ -7,7 +7,7 @@ void subghz_scene_show_gps_draw_satellites(void* context) {
FuriString* text = furi_string_alloc();
FuriString* time_text = furi_string_alloc();
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;

View File

@@ -210,10 +210,7 @@ bool subghz_history_get_text_space_left(
furi_string_printf(output, "%02u", instance->last_index_write);
return false;
} else {
FuriHalRtcDateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if(furi_hal_rtc_datetime_to_timestamp(&datetime) % 2) {
if(furi_hal_rtc_get_timestamp() % 2) {
furi_string_printf(output, "%02u", instance->last_index_write);
} else {
furi_string_printf(output, "%d sats", sats);

View File

@@ -69,7 +69,7 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
char second_str[5];
char date_str[14];
char meridian_str[3];
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
LocaleTimeFormat time_format = locale_get_time_format();
LocaleDateFormat date_format = locale_get_date_format();

View File

@@ -73,9 +73,7 @@ bool dolphin_state_load(DolphinState* dolphin_state) {
}
uint64_t dolphin_state_timestamp() {
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
return datetime_datetime_to_timestamp(&datetime);
return furi_hal_rtc_get_timestamp();
}
bool dolphin_state_is_levelup(uint32_t icounter) {

View File

@@ -225,9 +225,7 @@ static void clock_tick(void* ctx) {
void timer_start_stop(ClockState* plugin_state) {
// START/STOP TIMER
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();
if(plugin_state->timer_running) {
// Update stopped seconds

View File

@@ -120,9 +120,7 @@ SubGhzProtocolStatus tpms_block_generic_serialize(
}
//DATE AGE set
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();
temp_data = curr_ts;
if(!flipper_format_write_uint32(flipper_format, "Ts", &temp_data, 1)) {

View File

@@ -121,9 +121,7 @@ SubGhzProtocolStatus ws_block_generic_serialize(
}
//DATE AGE set
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();
temp_data = curr_ts;
if(!flipper_format_write_uint32(flipper_format, "Ts", &temp_data, 1)) {