/* Convert time structure to register_value. Retrieves register_value convert by the time structure.  */
uint32_t rtc_calendar_time_to_register_value(struct rtc_module *const module, const struct rtc_calendar_time *const time)
/* Convert time structure to register_value. Retrieves register_value convert by the time structure.  */
uint32_t rtc_calendar_time_to_register_value(struct rtc_module *const module, const struct rtc_calendar_time *const time)
{
	uint32_t register_value;
	register_value = (time->year - module->year_init_value) <<
			RTC_MODE2_CLOCK_YEAR_Pos;
	register_value |= (time->month << RTC_MODE2_CLOCK_MONTH_Pos);
	register_value |= (time->day << RTC_MODE2_CLOCK_DAY_Pos);
	register_value |= (time->hour << RTC_MODE2_CLOCK_HOUR_Pos);
	if (!(module->clock_24h) && (time->pm)) {
		register_value |= (0x10u << RTC_MODE2_CLOCK_HOUR_Pos);
	}
	register_value |= (time->minute << RTC_MODE2_CLOCK_MINUTE_Pos);
	register_value |= (time->second << RTC_MODE2_CLOCK_SECOND_Pos);
	return register_value;
}