timezone_utils.h 508 B

123456789101112131415161718
  1. #pragma once
  2. #include <inttypes.h>
  3. /**
  4. * @brief Calculates timezone offset in seconds given timezone offset in hours.
  5. * @param hours timezone offset in hours
  6. * @return Timezone offset in seconds.
  7. */
  8. int32_t timezone_offset_from_hours(float hours);
  9. /**
  10. * @brief Applies timezone offset to a given time.
  11. * @param time time to apply offset to.
  12. * @param offset timezone offset in seconds.
  13. * @return Time with timezone offset applied.
  14. */
  15. uint64_t timezone_offset_apply(uint64_t time, int32_t offset);