No,
however I did use the RTC lib for the DS1307 - - GitHub - adafruit/RTClib: A fork of Jeelab's fantastic RTC Arduino library - It includes a DateTime Class that has all needed to implement a time2string(...) function
Note DateTime is year 2000 based, the essential code is in the DateTime constructor that can be transformend quite easily, see below:
void setup()
{
Serial.begin(115200);
Serial.println("UnixTime simulator :) ");
}
void loop()
{
char buffer[20];
time2string(millis(), buffer);
Serial.print(millis());
Serial.print(" ==> ");
Serial.println(buffer);
}
uint8_t daysInMonth [] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
void time2string(unsigned long t, char *buf)
{
uint8_t yOff, m, d, hh, mm, ss;
ss = t % 60;
t /= 60;
mm = t % 60;
t /= 60;
hh = t % 24;
uint16_t days = t / 24;
uint8_t leap;
for (yOff = 0; ; ++yOff) {
leap = yOff % 4 == 0;
if (days < 365 + leap)
break;
days -= 365 + leap;
}
for (m = 1; ; ++m) {
uint8_t daysPerMonth = daysInMonth[ m - 1];
if (leap && m == 2)
++daysPerMonth;
if (days < daysPerMonth)
break;
days -= daysPerMonth;
}
d = days + 1;
sprintf(buf,"%4d-%02d-%02d %02d:%02d:%02d", 1970+yOff, m,d, hh,mm,ss);
}