CronAlarms
CronAlarms copied to clipboard
Compiler warning: ISO C++ forbids converting a string constant to 'char*'
warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] Cron.create("0 30 8 * * *", setBrightnessMaxDayPerCron, false);
I have the same worrying warning. I have crashes where the debugger points to cronalarms, cannot 100% say it is related but would be good to have a clean compilation without warning.
I fix this way -events for exemple- :
char s[20] ;
strcpy( s,"0 30 8 * * *"); Cron.create(s , MorningAlarm, false); // 8:30am every day
strcpy( s,"0 45 17 * * *"); Cron.create(s, EveningAlarm, false); // 5:45pm every day
But .. the sample provided does not return the annouced date (
` struct tm tm_newtime; // set time to Saturday 8:29:00am Jan 1 2011
18:38:23.752 -> Thu Jan 1 00:00:00 1970`
The problem is there: settimeofday must be called with NULL as second parameter:
// https://forum.arduino.cc/t/esp32-settimeofday-functionality-giving-odd-results/676136/2
Serial.println(settimeofday(&tv, NULL));
I get the same warning, but i affraid it will fixed in this 4 years old repository :-(