Is there a published data structure for storing periodic or recurring dates? Something that can handle:
- The pump need recycling every five days.
- Payday is every second Friday.
- Thanksgiving Day is the second Monday in October (US: the fourth Thursday in November).
- Valentine's Day is every February 14th.
- Solstice is (usually) every June 21st and December 21st.
- Easter is the Sunday after the first full moon on or after the day of the vernal equinox (okay, this one's a bit of a stretch).
I reckon cron
's internal data structure can handle #1, #4, #5 (two rules), and maybe #2, but I haven't had a look at it. MS Outlook and other calendars seem to be able to handle the first five, but I don't have that source code lying around.