Best Data model/Concept to Store Multi-Day Alarm for clock? I'm writing a multiday day alarm program for a project.
I'm not sure how I want to store the format of each of 10 alarms....I need to store it...in SPIFFS retrieve it(at boot) and then compare it to the current day of the week and time so as to fire off the alarm..I was thinking of storing it in a 10 member array.
First alarm would be every day at 2PM and the second is turned off but would be Mon tues Thursday at 10AM. was going to use strtok_r to extract all of the pieces and compare them every minutte to see if an alarm is needed.
Every minute
{&quot;1|M|T|W|T|F|S|S|14|00&quot;,&quot;0|M|T||T|||S|10|00&quot;}
I would suggest a bit field for storing the days of the week when the
alarm is supposed to fire:

bit 0: fire on Sundays
bit 1: fire on Mondays
...

This numbering is meant to match the one of DateTime::dayOfTheWeek().
Pack this, together with the hour and minute of the alarm, in a struct
(or a class if you prefer). Maybe add a boolean to tell whether the
alarm is active. For example:
struct Alarm {
    bool is_on;
    uint8_t days;  // bitfield: 0 = Sunday
    uint8_t hour;
    uint8_t minute;
    bool matches(DateTime) const;
};

bool Alarm::matches(DateTime t) const {
    bool day_matches = days &amp; (1 &lt;&lt; t.dayOfTheWeek());
    return day_matches &amp;&amp; t.hour() == hour &amp;&amp; t.minute() == minute;
}

Then if (alarm.is_on &amp;&amp; alarm.matches(rtc.now())), the alarm fires.