AceTime  1.11.6
Date and time classes for Arduino that support timezones from the TZ Database.
ace_time_utils.h
1 /*
2  * MIT License
3  * Copyright (c) 2022 Brian T. Park
4  */
5 
6 #ifndef ACE_TIME_TIME_UTILS_H
7 #define ACE_TIME_TIME_UTILS_H
8 
9 namespace ace_time {
10 
18 inline int16_t daysUntil(const LocalDate& today, uint8_t month, uint8_t day) {
19  int16_t year = today.year();
20  LocalDate target = LocalDate::forComponents(year, month, day);
21  if (today.compareTo(target) > 0) {
22  target.year(year + 1);
23  }
24  return target.toEpochDays() - today.toEpochDays();
25 }
26 
27 }
28 
29 #endif
static LocalDate forComponents(int16_t year, uint8_t month, uint8_t day)
Factory method using separated year, month and day fields.
Definition: LocalDate.h:123