Autonomo: RTC counting up to 28h... then resets to 12:00:00?!?

The below code gives me next output:

15/12/15 23:59:58
15/12/15 23:59:59
15/12/15 24:0:0
15/12/15 24:0:1

And even further on:

15/12/15 27:59:58
15/12/15 27:59:59
16/12/15 12:0:0
16/12/15 12:0:1

Can someone explain this?

include RTCZero.h
RTCZero rtc;
void setup()
while ((!SerialUSB) && (millis() < 10000));
rtc.setTime(23, 59, 55);
rtc.setDate(15, 12, 15);
void loop()
SerialUSB.print(" “);

Sorry that it took so long to respond. I was hoping someone else would jump in :smile:

First thing I noticed is that begin has no parameter, huh? In the RTCZero that I have the function begin has a bool parameter to flag 12 or 24 hour clock. So, … which RTCZero library do you use? Do you have a Github url or something, so that I can have a look?

O, I see that I have to update mine. :frowning:

Anyway, it looks like someone else (or maybe it was you) reported to issue at the RTCZero gihub. See

The RTCZero from Gabriel Notman does not have that bug anymore, beit taht the commit messages does explicitly say that this was solved.

For the time being you may want to use Gabriel’s version.


Hmmm… I checked the history on Gabriel’s version, but I could not find anything on that issue. So I didn’t bother trying out that version. Will try that tomorrow.

The main library from Arduino sets one of the registers bits incorrectly CTRL.CLKREP.
As such it is actually putting it in 12hr mode with the next highest bit specifying AM/PM. If this is read directly all PM values are +16.

I have brought this to their attention twice already.I also have an active pull request to bring this and the epoch functionality into the main library.

@keesbakker the library previously supported both 12 and 24 hour modes. However, this was considered to be confusing and error prone and so it just uses 24 hour mode now.

I can confirm that I was indeed using the other version of the RTCZero library and that switching to the version of Gabriel worked for me.


I got an email today with confirmation that they had merged my pull request.
You should be able to use the official library without problem now.