/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect  */
status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
/* return kStatus_Success: Success in setting the time and starting the SNVS SRTC kStatus_InvalidArgument: Error because the datetime format is incorrect  */
status_t SNVS_LP_SRTC_SetDatetime(SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime)
{
    assert(datetime);
    uint32_t seconds = 0U;
    uint32_t tmp = base->LPCR;
    SNVS_LP_SRTC_StopTimer(base);
    if (!(SNVS_LP_CheckDatetimeFormat(datetime)))
    {
        return kStatus_InvalidArgument;
    }
    seconds = SNVS_LP_ConvertDatetimeToSeconds(datetime);
    base->LPSRTCMR = (uint32_t)(seconds >> 17U);
    base->LPSRTCLR = (uint32_t)(seconds << 15U);
    if (tmp & SNVS_LPCR_SRTC_ENV_MASK)
    {
        SNVS_LP_SRTC_StartTimer(base);
    }
    return kStatus_Success;
}