Flipper/Applications/Official/source-OLDER/xMasterX/flipp_pomodoro/helpers/time.h

26 lines
661 B
C
Raw Normal View History

2023-01-26 07:52:38 +00:00
#pragma once
#include <furi.h>
#include <furi_hal.h>
extern const int TIME_SECONDS_IN_MINUTE;
extern const int TIME_MINUTES_IN_HOUR;
/// @brief Container for a time period
typedef struct
{
uint8_t seconds;
uint8_t minutes;
uint32_t total_seconds;
} TimeDifference;
/// @brief Time by the moment of calling
/// @return A timestamp(seconds percision)
uint32_t time_now();
/// @brief Calculates difference between two provided timestamps
/// @param begin - start timestamp of the period
/// @param end - end timestamp of the period to measure
/// @return TimeDifference struct
TimeDifference time_difference_seconds(uint32_t begin, uint32_t end);