CronAlarms icon indicating copy to clipboard operation
CronAlarms copied to clipboard

Compiler warning: ISO C++ forbids converting a string constant to 'char*'

Open micha6554 opened this issue 2 years ago • 3 comments

warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] Cron.create("0 30 8 * * *", setBrightnessMaxDayPerCron, false);

micha6554 avatar Feb 13 '23 21:02 micha6554

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.

rrelande avatar Mar 07 '23 09:03 rrelande

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));

lucberger avatar Apr 01 '23 11:04 lucberger

I get the same warning, but i affraid it will fixed in this 4 years old repository :-(

Starwhooper avatar Aug 04 '23 09:08 Starwhooper