/* Sets the current time in broken down format directly from to RTC.  */
int rtc_set_time(struct tm *localt)
/* Sets the current time in broken down format directly from to RTC.  */
int rtc_set_time(struct tm *localt)
{
    if (localt == NULL) {
        return -1;
    }
    RTC_SEC = localt->tm_sec;
    RTC_MIN = localt->tm_min;
    RTC_HOUR = localt->tm_hour;
    RTC_DOM = localt->tm_mday;
    RTC_DOW = localt->tm_wday;
    RTC_DOY = localt->tm_yday;
    RTC_MONTH = localt->tm_mon + 1;
    RTC_YEAR = localt->tm_year;
    return 0;
}