RTC library with unix time out


Has anyone used Jack Christensen's RTC library in their sketch? If so does it output Unix time?

john Mims, Fl.

I think that the now() function returns the unix time.

The Christensen library integrates with the Time Library and now() is a time library function which will return the "unix time" is the library is synchronized with the rtc time.

There is also the .get() function with within DS3232.h. It uses the make time function of the time library to generate/return the unix time from the year/month/day/hour/minute/second values read from the rtc storage registers.

time_t DS3232RTC::get()
    tmElements_t tm;

    if ( read(tm) ) return 0;
    return( makeTime(tm) );

Otherwise there's the timeLib library, which offers lots of time functions including now(). Some RTC libraries actually use that library.

Check the documentation of your specific library on available commands.