Go Down

Topic: Update to TimeAlarms Library - thread for discussing beta testing (Read 3 times) previous topic - next topic


You can find a beta update to TimeAlarms and Time library here. TimeAlarms makes it easy to create tasks at specific times or after specific intervals when used with the companion Time library.

The new TimeAlarms code uses an improved  framework for storing alarm triggers that makes it more extensible and fixes a problem with recurring weekly alarms.
A readme file in the download contains more details on this update)

If you are using the current Library and not using recurring weekly alarms than you should not see any difference. But the new version will make it easier to add functionality so I would appreciate feedback from anyone that cares to test this. Note that you should install both the TIme and TImeAlarms libraries from the beta zip.

This is the text in the release note:

Changes made July 5 2011:

This is a beta test version of the libraries that provides a fix for recurring weekly alarms.

The Time library is unchanged except for fixes to a macro in Time.h that converts the number of days to elapsed seconds and the macros that are used
to calculate weekly alarms.

The functionality of the TimeAlarms library has changed slightly in order to make the library easier to maintain and enhance.

In short, if your application used an Alarm method to create weekly alarms then you should change your sketch  to use the methods that take the explicit DayOfWeek parameter. Only the Alarm methods are affected, Timer methods are as before.

Here are the details:
The previous version could set weekly alarms by calling the AlarmOnce method with a value greater than one day to indicate the day and time of the weekly alarm. This has changed and explicit calls to set weekly alarms must be used when setting weekly alarms. If you were setting weekly alarms by calling either
   Alarm.alarmRepeat(weeklyValue,  AlarmFunction);
then you need to change this to:
  arm.alarmRepeat(DayOfWeek, Hour, Minute, Second,  AlarmFunction);
Also the clock must be set to a time on or after Jan1 1971 when using the Alarm methods.
Timer methods are unchanged and will function even if the clock has not been set

The forum discussion that prompted this update can be found here


Has anyone had an opportunity to test this?

If I don't hear of any problems I will  update the playground.
It would be good to get positive confirmation that the Libraries are working as expected.


I know this is a little late but I wish you could combine Jack Christensen TimeZone with your Time libraries. They both have some of the same data types for one, and would complement the Time Library.

Also before I go, I wanted to point out that the library for the DS1307 should include a note that the DS3231 {Chronodot} according to Adafruit use the same I2C registers addresses as the DS1307 { https://www.adafruit.com/products/255 }. PLUS, The DS3231 {Chronodot}  has a temperature compensated internal crystal which means it has a stable frequency, which means it will drift less than a minute per year. You might want to point that out in your readme.txt file. Also, for my copy of Time I went and pulled your readme.txt file into the Time.h file so the information is tied together and less likely get confused with a different library.

Wyolum has a I2GPS shield {http://wyolum.com/gps-over-i2c/} that has a standalone Arduino clone w uSD card, Fastrax UP501 GPS and DS3231 RTC so if the GPS loses signal the DS3231 can take over. Also the GPS can also check the DS3231 to make sure the time is correct when you do have signal. THE REALLY COOL PART- Wyolum is working on a sketch that auto figures out the TimeZone- using the SD card to store the 'map/library' of the entire world Time Zones.

I have been having problems with multiple copies of your Time libraries across the web. I almost wish you had something like Mikal Hart does to identify his TinyGPS library-> 

#define _TinyGPS_VERSION 12 // software version of this library

Then under debug you can set the program to print out which version and who made it.
And he uses the following in his .ino sketch to spell out which version of program he is using >>

void setup()

… some code….

#if debug
    Serial.print("Testing TinyGPS library v. ");

…more code….



I'm also quite late, but it seems there is a bug with repeating timers at midnight.

If I set this: Alarm.alarmRepeat(0,0,0, FUNC_STUFF);

The Alarm is always disabled and I cannot enable it.


… I wish you could combine Jack Christensen TimeZone with your Time libraries.

I have not seen that library but will have a look. If that library currently works with the time library, would there be any functional benefit in combining them?

I have been having problems with multiple copies of your Time libraries across the web.

The time.cpp file has version information in the header along with a brief description of the changes. My latest version has edits dated 24 March 2012.

Having a standard way to determine a library version and capabilities is one of a number of improvements being discussed for Arduino libraries by the Arduino developer community.

Go Up