diff options
Diffstat (limited to 'src/c')
| -rw-r--r-- | src/c/fastforge_core.c | 18 | ||||
| -rw-r--r-- | src/c/fastforge_logic.c | 25 | ||||
| -rw-r--r-- | src/c/fastforge_logic.h | 1 |
3 files changed, 18 insertions, 26 deletions
diff --git a/src/c/fastforge_core.c b/src/c/fastforge_core.c index 39d9ea8..5254956 100644 --- a/src/c/fastforge_core.c +++ b/src/c/fastforge_core.c @@ -61,6 +61,24 @@ static int compare_time_t_ascending(const void *a, const void *b) { return 0; } +static time_t local_day_start(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 64fe776..b93240d 100644 --- a/src/c/fastforge_logic.c +++ b/src/c/fastforge_logic.c @@ -1,11 +1,5 @@ #include "fastforge_logic.h" -#if defined(__has_include) -#if __has_include(<pebble.h>) -#include <pebble.h> -#endif -#endif - #include <stdio.h> #include <time.h> @@ -61,25 +55,6 @@ void format_duration_hours_minutes(time_t seconds, char *buffer, size_t size) { snprintf(buffer, size, "%dh %02dm", hours, minutes); } -time_t local_day_start(time_t timestamp) { - if (timestamp <= 0) { - return 0; - } - - struct tm tm_copy; - struct tm *tm_info = localtime(×tamp); - if (!tm_info) { - return 0; - } - - 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) { if (!entry || entry->start_time == 0 || entry->end_time != 0 || entry->target_minutes == 0) { return false; diff --git a/src/c/fastforge_logic.h b/src/c/fastforge_logic.h index 4ccaba7..7108da8 100644 --- a/src/c/fastforge_logic.h +++ b/src/c/fastforge_logic.h @@ -12,7 +12,6 @@ uint8_t stage_level_for_elapsed(time_t elapsed_seconds); const char *stage_text_for_elapsed(time_t elapsed_seconds); void format_hhmmss(time_t seconds, char *buffer, size_t size); void format_duration_hours_minutes(time_t seconds, char *buffer, size_t size); -time_t local_day_start(time_t timestamp); bool running_fast_is_at_target(const FastEntry *entry, time_t now); #endif |
