From 8fb892cbef029674d39327ab96fa09c8e7a9411b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 13 Apr 2026 08:17:36 +0300 Subject: n2: finalize local_day_start in Pebble-free logic module --- src/c/fastforge_core.c | 18 ------------------ src/c/fastforge_logic.c | 23 ++++++++++++++++++++--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/c/fastforge_core.c b/src/c/fastforge_core.c index c9d3ce1..39d9ea8 100644 --- a/src/c/fastforge_core.c +++ b/src/c/fastforge_core.c @@ -61,24 +61,6 @@ static int compare_time_t_ascending(const void *a, const void *b) { return 0; } -time_t fastforge_local_day_start_platform(time_t timestamp) { - if (timestamp <= 0) { - return 0; - } - - struct tm *tm_info = localtime(×tamp); - if (!tm_info) { - return 0; - } - - struct tm tm_copy = *tm_info; - tm_copy.tm_hour = 0; - tm_copy.tm_min = 0; - tm_copy.tm_sec = 0; - tm_copy.tm_isdst = -1; - return mktime(&tm_copy); -} - static bool is_next_local_day(time_t first_day, time_t second_day) { if (first_day <= 0 || second_day <= 0 || second_day < first_day) { return false; diff --git a/src/c/fastforge_logic.c b/src/c/fastforge_logic.c index b765e83..c4c14f3 100644 --- a/src/c/fastforge_logic.c +++ b/src/c/fastforge_logic.c @@ -1,6 +1,15 @@ #include "fastforge_logic.h" #include +#ifdef _TIME_H_ +#undef _TIME_H_ +#endif +#ifndef __time_t_defined +#define __time_t_defined +#endif +#ifndef _TIME_T_DECLARED +#define _TIME_T_DECLARED +#endif #include @@ -56,14 +65,22 @@ void format_duration_hours_minutes(time_t seconds, char *buffer, size_t size) { snprintf(buffer, size, "%dh %02dm", hours, minutes); } -time_t fastforge_local_day_start_platform(time_t timestamp); - time_t local_day_start(time_t timestamp) { if (timestamp <= 0) { return 0; } - return fastforge_local_day_start_platform(timestamp); + struct tm *tm_info = localtime(×tamp); + if (!tm_info) { + return 0; + } + + struct tm tm_copy = *tm_info; + tm_copy.tm_hour = 0; + tm_copy.tm_min = 0; + tm_copy.tm_sec = 0; + tm_copy.tm_isdst = -1; + return mktime(&tm_copy); } bool running_fast_is_at_target(const FastEntry *entry, time_t now) { -- cgit v1.2.3