PaulStoffregen / TimeAlarms

Time library add-on, schedule alarms to occur at specific dates/times
http://www.pjrc.com/teensy/td_libs_TimeAlarms.html
167 stars 102 forks source link

TimeAlarmsClass::create: paranoia check avoids creating alarms before system time is set #48

Open KollegeJens opened 4 years ago

KollegeJens commented 4 years ago

Description

Time check in TimeAlarmsClass::create avoids that alarms can be created before system time is set

System time has at least to elapse 1 year (1.1.1971) before alarms can be added. I don't see a reason not to allow this. This one is required for setting up a alarm schedule at startup in combination with system time is setup later on (ie. as soon as NTP server is reachable)

if ( ! ( (dtIsAlarm(alarmType) && **now() < SECS_PER_YEAR**) || (dtUseAbsoluteValue(alarmType) && (value == 0)) ) ) {

Steps To Reproduce Problem

Alarm.alarmRepeat(1, handle); setTime(0);

Hardware & Software

TimeAlarms 1.5.0

tonilopezmr commented 4 years ago

I'm having the same problem, but I set alarms after setTime