diff --git a/include/btstack/run_loop.h b/include/btstack/run_loop.h index c77233e6f..85dd43b4d 100644 --- a/include/btstack/run_loop.h +++ b/include/btstack/run_loop.h @@ -108,6 +108,8 @@ void run_loop_execute(void); uint32_t embedded_ticks_for_ms(uint32_t time_in_ms); // Queries the current time in ticks. uint32_t embedded_get_ticks(void); +// Queries the current time in ms +uint32_t embedded_get_time_ms(void); // Allows to update BTstack system ticks based on another already existing clock void embedded_set_ticks(uint32_t ticks); #endif diff --git a/src/run_loop_embedded.c b/src/run_loop_embedded.c index 2e17d7270..219d597f6 100644 --- a/src/run_loop_embedded.c +++ b/src/run_loop_embedded.c @@ -204,6 +204,11 @@ void embedded_set_ticks(uint32_t ticks){ uint32_t embedded_ticks_for_ms(uint32_t time_in_ms){ return time_in_ms / hal_tick_get_tick_period_in_ms(); } + +uint32_t embedded_get_time_ms(void){ + return system_ticks * hal_tick_get_tick_period_in_ms(); +} + #endif /**