]> git.earman.xyz Git - sensor-watch.git/commitdiff
add function for long weekdays
authorjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 18:19:14 +0000 (14:19 -0400)
committerjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 19:24:43 +0000 (15:24 -0400)
watch-library/shared/watch/watch_utility.c
watch-library/shared/watch/watch_utility.h

index 95869776adff04d77a0d8aef45a5b1c95f65a088..337797e1645cddc0637dbe3244dec0d3e343acc7 100644 (file)
@@ -30,6 +30,11 @@ const char * watch_utility_get_weekday(watch_date_time date_time) {
     return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1];
 }
 
+const char * watch_utility_get_long_weekday(watch_date_time date_time) {
+    static const char weekdays[7][4] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
+    return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1];
+}
+
 // Per ISO8601 week starts on Monday with index 1
 uint8_t watch_utility_get_iso8601_weekday_number(uint16_t year, uint8_t month, uint8_t day) {
     year -= WATCH_RTC_REFERENCE_YEAR;
index 462963e083dc2ee48f4d3ba506a458b4a46a5ef2..6cb35553e4df81dd8d4d9a7da001d9b7933d577f 100644 (file)
@@ -45,12 +45,16 @@ typedef struct {
     uint32_t days;    // 0-4294967295
 } watch_duration_t;
 
-/** @brief Returns a two-letter weekday for the given timestamp, suitable for display
-  *        in positions 0-1 of the watch face
+/** @brief Returns a two-letter weekday for the given timestamp, suitable for display in positions 0-1 of the watch face
   * @param date_time The watch_date_time whose weekday you want.
   */
 const char * watch_utility_get_weekday(watch_date_time date_time);
 
+/** @brief Returns a three-letter weekday for the given timestamp, suitable for display on the custom LCD
+  * @param date_time The watch_date_time whose weekday you want.
+  */
+const char * watch_utility_get_long_weekday(watch_date_time date_time);
+
 /** @brief Returns a number between 1-7 representing the weekday according to ISO8601 : week starts on Monday and has index 1, Sunday has index 7
  * @param year The year of the date
  * @param month The month of the date (1-12)