Problem Compiling Time Library


I’m trying to use the Time library to turn lights on and off at set intervals. I downloaded the Time library here:

I copied the DS1307RTC, Time and TimeAlarms folders and pasted them in the libraries folder within the Arduino folder.

When I open “TimeAlarmExample.pde” and attempt to compile, I get the following error:

In file included from /Users/jamesgladden/Documents/Arduino/libraries/Time/DateStrings.cpp:10:0:
/Users/jamesgladden/Documents/Arduino/libraries/Time/DateStrings.cpp:18:18: error: variable ‘monthStr1’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
char monthStr1 PROGMEM = “January”;

The error repeats for about 12 other variables.

The download is new and the code is from one of the examples. Did I do something wrong in installing the library or is there something I need to do before I use it?


There have been some changes with the way progmem variables are handled in the new version of the IDE. I've been having the same issue.

If you use IDE version 1.0.6 or earlier it will compile. Otherwise we're stuck waiting for someone to update the time library.

Maybe I'll do that now.

Here is a version that will compile in 1.5.8

It should compile as well in 1.6.0 but I don’t have it handy to try and I’m not upgrading right at this moment.

Try it out and let me know if anything is broken. I didn’t really test it so much. But it appears to work. All I did was fix all the progmem types, I didn’t change any of the functions. If I set a time and then print the current time in the loop everything goes as planned.

Just use these files to replace the ones of the same name in the library folder you already have.

DateStrings.cpp (2.74 KB)

Time.cpp (8.04 KB)

Time.h (4.87 KB)