Somewhere on the site, it recommended a Sodaq DS3231 library, which is similar to the Mayfly. Make sure the coin battery is in.
I used the example to set the clock (took me ~10 sec to upload): https://github.com/SodaqMoja/Sodaq_DS3231/blob/master/examples/adjust/adjust.pde
Then before powering down, I upload the code for data-logging. If you power down and then re-power without uploading new code, it will reset the time for what you had adjusted from the above example.
Attached is my data-logging/xbee transparent (AT) communication code. It writes a csv string with time stamps then sensor data- weather station in my case via composite SDI-12 command. The FormatTS function just adds leading zeroes when needed. Sorry it’s in text format, the forum didn’t let me attach a .ino file.
There might be other RTC libraries, but i went with the safe route. -h