Real Time Clock - Seconds Input Ignored

The following example code:

Doesn’t seem to work, when RTC.start(); is called RTC.get(DS1307_SEC,false) returns 0 and the RTC counts onwards from there.
Anyone know what’s going on? Is this a library problem?

yes, it’s the library problem.

void DS1307::start(void)
// unset the ClockHalt bit to start the rtc
// TODO : preserve existing seconds

when you RTC.set(DS1307_SEC,52); , and you call a RTC.start(); , this functiom will clean the second value. so you can set the RTC.set(DS1307_SEC,52) behind the RTC.start(); then it can work begin with 52 sec.
or you can modify the library to rtc_bcd[DS1307_SEC]&=0x7F;

Should have seen that myself, thank you for your help :confused:
Is that behaviour just the preference of the library’s author or is there a technical reason behind it?

I think the author just want to clear the CH bit of Register 00h .