/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect  */
status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect  */
status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
{
    assert(datetime != NULL);
    uint32_t seconds = 0U;
    uint32_t tmp     = base->HPCR;
    SNVS_HP_RTC_StopTimer(base);
    if (!(SNVS_HP_CheckDatetimeFormat(datetime)))
    {
        return kStatus_InvalidArgument;
    }
    seconds = SNVS_HP_ConvertDatetimeToSeconds(datetime);
    base->HPRTCMR = (uint32_t)(seconds >> 17U);
    base->HPRTCLR = (uint32_t)(seconds << 15U);
    if ((tmp & SNVS_HPCR_RTC_EN_MASK) != 0U)
    {
        SNVS_HP_RTC_StartTimer(base);
    }
    return kStatus_Success;
}