time.h 661 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. extern const int TIME_SECONDS_IN_MINUTE;
  5. extern const int TIME_MINUTES_IN_HOUR;
  6. /// @brief Container for a time period
  7. typedef struct
  8. {
  9. uint8_t seconds;
  10. uint8_t minutes;
  11. uint32_t total_seconds;
  12. } TimeDifference;
  13. /// @brief Time by the moment of calling
  14. /// @return A timestamp(seconds percision)
  15. uint32_t time_now();
  16. /// @brief Calculates difference between two provided timestamps
  17. /// @param begin - start timestamp of the period
  18. /// @param end - end timestamp of the period to measure
  19. /// @return TimeDifference struct
  20. TimeDifference time_difference_seconds(uint32_t begin, uint32_t end);