diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-04-06 14:33:29 -0400 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-04-06 14:33:29 -0400 |
commit | aff07ef9b346967468770d860686e344a66e9e86 (patch) | |
tree | 7d8a97675d846cec8d37f4845bd4af15d540d1c2 /watch-library/shared/watch | |
parent | f7ab99bb69baccee092b93f653e087364938f26b (diff) | |
parent | 1ec1f2e4207405d55c34c936e2c458cb4a7e8806 (diff) | |
download | Sensor-Watch-aff07ef9b346967468770d860686e344a66e9e86.tar.gz Sensor-Watch-aff07ef9b346967468770d860686e344a66e9e86.tar.bz2 Sensor-Watch-aff07ef9b346967468770d860686e344a66e9e86.zip |
Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into main
Diffstat (limited to 'watch-library/shared/watch')
-rw-r--r-- | watch-library/shared/watch/watch_utility.c | 8 | ||||
-rw-r--r-- | watch-library/shared/watch/watch_utility.h | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/watch-library/shared/watch/watch_utility.c b/watch-library/shared/watch/watch_utility.c index 3f8aa619..252624b3 100644 --- a/watch-library/shared/watch/watch_utility.c +++ b/watch-library/shared/watch/watch_utility.c @@ -188,3 +188,11 @@ float watch_utility_thermistor_temperature(uint16_t value, bool highside, float return reading; } + +uint32_t watch_utility_offset_timestamp(uint32_t now, int8_t hours, int8_t minutes, int8_t seconds) { + uint32_t new = now; + new += hours * 60 * 60; + new += minutes * 60; + new += seconds; + return new; +} diff --git a/watch-library/shared/watch/watch_utility.h b/watch-library/shared/watch/watch_utility.h index 4c50cb59..57bcbed7 100644 --- a/watch-library/shared/watch/watch_utility.h +++ b/watch-library/shared/watch/watch_utility.h @@ -124,4 +124,12 @@ watch_date_time watch_utility_date_time_convert_zone(watch_date_time date_time, */ float watch_utility_thermistor_temperature(uint16_t value, bool highside, float b_coefficient, float nominal_temperature, float nominal_resistance, float series_resistance); +/** @brief Offset a timestamp by a given amount + * @param now Timestamp to offset from + * @param hours Number of hours to offset + * @param minutes Nmber of minutes to offset + * @param seconds Number of secodns to offset + */ +uint32_t watch_utility_offset_timestamp(uint32_t now, int8_t hours, int8_t minutes, int8_t seconds); + #endif |