diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-01-31 21:17:10 -0800 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-01-31 21:17:10 -0800 |
commit | 518a9aa919711664a79d6784401f5b518f30296b (patch) | |
tree | 9e407a37165125a2ab8ecb2b83a259e024ecb48f /watch-library/shared/watch/watch_utility.c | |
parent | 7085f89bfa32f650ce99b0dc6b00c1e89f76697f (diff) | |
download | Sensor-Watch-518a9aa919711664a79d6784401f5b518f30296b.tar.gz Sensor-Watch-518a9aa919711664a79d6784401f5b518f30296b.tar.bz2 Sensor-Watch-518a9aa919711664a79d6784401f5b518f30296b.zip |
add function for converting to 12 hour time
Diffstat (limited to 'watch-library/shared/watch/watch_utility.c')
-rw-r--r-- | watch-library/shared/watch/watch_utility.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/watch-library/shared/watch/watch_utility.c b/watch-library/shared/watch/watch_utility.c index 835076d9..dd11c0eb 100644 --- a/watch-library/shared/watch/watch_utility.c +++ b/watch-library/shared/watch/watch_utility.c @@ -151,6 +151,13 @@ watch_date_time watch_utility_date_time_convert_zone(watch_date_time date_time, return watch_utility_date_time_from_unix_time(timestamp, destination_utc_offset); } +bool watch_utility_convert_to_12_hour(watch_date_time *date_time) { + bool is_pm = date_time->unit.hour > 11; + date_time->unit.hour %= 12; + if (date_time->unit.hour == 0) date_time->unit.hour = 12; + return is_pm; +} + float watch_utility_thermistor_temperature(uint16_t value, bool highside, float b_coefficient, float nominal_temperature, float nominal_resistance, float series_resistance) { float reading = (float)value; |