There are various papers describing data structures and algorithms for this use case. In addition you can see the code or descriptions of open source implementation of crontab and of Quartz (Java) or Quartz.NET (.NET).
This is one such paper
http://portal.acm.org/citation.cfm?id=359763.359801&coll=ACM&dl=ACM&CFID=63647367&CFTOKEN=55814330
For example, cron stores the information like this (*
means every, so a *
under month means every month)
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * *
There are several special entries, most of which are just shortcuts,
that can be used instead of specifying the full cron entry:
Entry Description Equivalent To
@reboot Run once, at startup. None
@yearly Run once a year 0 0 1 1 *
@annually (same as @yearly) 0 0 1 1 *
@monthly Run once a month 0 0 1 * *
@weekly Run once a week 0 0 * * 0
@daily Run once a day 0 0 * * *
@midnight (same as @daily) 0 0 * * *
@hourly Run once an hour 0 * * * *
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…