time.h 661 B

123456789101112131415161718192021222324
  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. uint8_t seconds;
  9. uint8_t minutes;
  10. uint32_t total_seconds;
  11. } TimeDifference;
  12. /// @brief Time by the moment of calling
  13. /// @return A timestamp(seconds percision)
  14. uint32_t time_now();
  15. /// @brief Calculates difference between two provided timestamps
  16. /// @param begin - start timestamp of the period
  17. /// @param end - end timestamp of the period to measure
  18. /// @return TimeDifference struct
  19. TimeDifference time_difference_seconds(uint32_t begin, uint32_t end);