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