summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkingannoy <36500946+kingannoy@users.noreply.github.com>2023-02-02 00:28:29 +0100
committerjoeycastillo <joeycastillo@utexas.edu>2023-02-10 17:08:32 -0600
commitc814c780e39692931dbb769018ef194bca613de9 (patch)
treef2d6bdf59c5f4e487a75180062a070e18898970d
parent827c3eb4a43b1a663139af8d07546c511d2b38ed (diff)
downloadSensor-Watch-c814c780e39692931dbb769018ef194bca613de9.tar.gz
Sensor-Watch-c814c780e39692931dbb769018ef194bca613de9.tar.bz2
Sensor-Watch-c814c780e39692931dbb769018ef194bca613de9.zip
Allow days in the future
With this small change you can also count down to a important upcoming event! This is my first time coding in C, so please double check everything! But in the emulator this seemed to work!
-rw-r--r--movement/watch_faces/complication/day_one_face.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/movement/watch_faces/complication/day_one_face.c b/movement/watch_faces/complication/day_one_face.c
index 00e711bc..7ce43bfa 100644
--- a/movement/watch_faces/complication/day_one_face.c
+++ b/movement/watch_faces/complication/day_one_face.c
@@ -37,7 +37,11 @@ static void _day_one_face_update(day_one_state_t state) {
watch_date_time date_time = watch_rtc_get_date_time();
uint32_t julian_date = _day_one_face_juliandaynum(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day);
uint32_t julian_birthdate = _day_one_face_juliandaynum(state.birth_year, state.birth_month, state.birth_day);
- sprintf(buf, "DA %6lu", julian_date - julian_birthdate);
+ if (julian_date < julian_birthdate) {
+ sprintf(buf, "DA %6lu", julian_birthdate - julian_date);
+ } else {
+ sprintf(buf, "DA %6lu", julian_date - julian_birthdate);
+ }
watch_display_string(buf, 0);
}