/* ajust RTC second or subsecond value of current time  */
ErrStatus rtc_second_ajust(uint32_t add, uint32_t minus)
/* ajust RTC second or subsecond value of current time  */
ErrStatus rtc_second_ajust(uint32_t add, uint32_t minus)
{
    uint32_t time_index = RTC_SHIFTCTL_TIMEOUT;
    ErrStatus error_status = ERROR;
    uint32_t flag_status = RESET;
    RTC_WPK = RTC_UNLOCK_KEY1;
    RTC_WPK = RTC_UNLOCK_KEY2;    
    do{
        flag_status = RTC_STAT & RTC_STAT_SOPF;
    }while((--time_index > 0) && ((uint32_t)RESET != flag_status));
    if(((uint32_t)RESET == flag_status) && (RESET == (RTC_CTL & RTC_CTL_REFEN))){  
        RTC_SHIFTCTL = (uint32_t)(add | SHIFTCTL_SFS(minus));
        error_status = rtc_register_sync_wait();        
    }
    RTC_WPK = RTC_LOCK_KEY;
    return error_status;
}