Go Down

Topic: Time and TimeAlarms Libraries – Ask here for help or suggestions (Read 77 times) previous topic - next topic

Nick Gammon


I am working with DS1307, and I noticed that if the module is not connected, the library return time value instead of reporting error. I think this should be corrected. I noticed this with weak battery in the DS1307 module, then I played with disconnecting module at all. I am programmer and am able to correct this bug myself, but I think better way is 1) not having modified versions of "standard" libraries and 2) fixing this would be good for entire community. Several ways of fixing is for example: Check device on the I2C bus, writing some "magic" bytes when setting time to the DS1307 memory and then checking them, and most paranoid, perhaps checking all bits in the time information which _should_ be 0, if they really _are_ 0.


Hi ladinek,

I would be happy to add this feature to the library after it is well tested with the various chips compatible  with DS1307 that the library currently works with.
I suggest you create a new thread for your DS1307 enhancements when you are ready to post some code, and add a link to that thread here.

Michael Margolis



Thanks a lot, I had the same problem. It seems to be proper solution.

Thanks again


One more question, I have noticed you declare member functions of the DS1307 class as _static_, I tried to add one private variable and had problems compiling. So I googled a lot, and static class member function is not the same as the static function in "classic" C. It has something to do with "this". In other libraries member function are not declared as static. Can you explain reasons for this?

Go Up