Jun
20
alarm.class.php had recently surpassed sweetass for the most downloaded plugin on this site. Noting that, I figured I’d do the right thing and fix it! The bug had to do with same-day alarms after a restart; they would queue up in the past and never fire. One way around that (that you’ll see in the demo config) is the use of the nextAmong method, where you can queue up the appropriate time.
‘time’=> nextAmong( array(
strtotime( ‘today 11:30am’ ),
strtotime( ‘tomorrow 11:30am’ )
))
Using the recalc callback of ‘tomorrow’, these alarms should always be right. If you have irregular times (like my example of burritos every Monday and Friday), you can assign the time-strings to an array and reuse it as in the plugin code.
I didn’t add a way to add or remove alarms because of the new reload method added to the operator class. I did however add some functions that you can interface with. Alarm handles now have names, and they can be listed with the command .getAlarms . You can also get the seconds until the alarm fires by giving it as an argument to the .timetil command.
.timetil burrito
For debugging and sanity checking, I also left a public strtotime method.