/* Write current date/time or alarm date/time to RTC setting. 
The  */
void RTCTimeWrite(tTime *tTime, unsigned long ulTimeAlarm)
/* Write current date/time or alarm date/time to RTC setting. 
The  */
void RTCTimeWrite(tTime *tTime, unsigned long ulTimeAlarm)
{
    unsigned long ulTemp;
    xASSERT((ulTimeAlarm == RTC_TIME_CURRENT) ||
            (ulTimeAlarm == RTC_TIME_ALARM));
    xASSERT((tTime->ulYear >= RTC_YEAR_OFFSET) &&
            (tTime->ulYear <= RTC_YEAR_OFFSET + 99));
    xASSERT((tTime->ulMonth >= 1) && 
            (tTime->ulMonth <= 12));
    xASSERT((tTime->ulMDay >= 1) &&
            (tTime->ulMDay <= 31));
    xASSERT((tTime->ulHour >= 0) &&
            (tTime->ulHour <=  23));
    RTCStop();
    ulTemp = xRTCConvertTimeToCounter((xtTime *)tTime);
    if (ulTimeAlarm == RTC_TIME_CURRENT)
    {
        SysCtlBackupRegWrite(0, ulTemp);
    }
    else
    {
        SysCtlBackupRegWrite(1, ulTemp);
    }
    RTCStart();
}