XilinxProcessorIPLib/drivers/rtcpsu/src/xrtcpsu.c
u32 XRtcPsu_DateTimeToSec(XRtcPsu_DT *dt)
{
	u32 i;
	u32 Days;
	u32 Seconds;

	Xil_AssertNonvoid(dt != NULL);

	if (dt->Year >= 2000U)
        {
		dt->Year -= 2000U;
        }

	for (i = 1U; i < dt->Month; i++)
        {
		dt->Day += (u32)DaysInMonth[i - (u32)1];
        }
	if ((dt->Month > 2U) && ((dt->Year % 4U) == 0U))
        {
		dt->Day++;
        }
	Days = dt->Day + (365U * dt->Year) + ((dt->Year + 3U) / 4U);
	Seconds = (((((Days * 24U) + dt->Hour) * 60U) + dt->Min) * 60U)
							+ dt->Sec;
	return Seconds;
}
/****************************************************************************/
/**
 *
 * This function translates time in YEAR:MON:DAY HR:MIN:SEC format to
 * seconds.
 *
 * @param	dt is a pointer to a DatetTime format structure variable
 *		of time that has to be shown in seconds.
 *
 * @return	Seconds value of provided in dt time.
 *
 * @note		None.
 *
 *****************************************************************************/
This function translates time in YEAR:MON:DAY HR:MIN:SEC format to
seconds.

@param       dt is a pointer to a DatetTime format structure variable
of time that has to be shown in seconds.

@return      Seconds value of provided in dt time.

@note                None.
This function translates time in YEAR : MON : DAY HR : MIN : SEC format to seconds . @param dt is a pointer to a DatetTime format structure variable of time that has to be shown in seconds . @return Seconds value of provided in dt time . @note None .
u32 XRtcPsu_DateTimeToSec(XRtcPsu_DT *dt)
{
	u32 i;
	u32 Days;
	u32 Seconds;
	Xil_AssertNonvoid(dt != NULL);
	if (dt->Year >= 2000U)
        {
		dt->Year -= 2000U;
        }
	for (i = 1U; i < dt->Month; i++)
        {
		dt->Day += (u32)DaysInMonth[i - (u32)1];
        }
	if ((dt->Month > 2U) && ((dt->Year % 4U) == 0U))
        {
		dt->Day++;
        }
	Days = dt->Day + (365U * dt->Year) + ((dt->Year + 3U) / 4U);
	Seconds = (((((Days * 24U) + dt->Hour) * 60U) + dt->Min) * 60U)
							+ dt->Sec;
	return Seconds;
}
u32 XRtcPsu_DateTimeToSec ( XRtcPsu_DT * dt ) { u32 i ; u32 Days ; u32 Seconds ; Xil_AssertNonvoid ( dt != NULL ) ; if ( dt -> Year >= 2000U ) { dt -> Year -= 2000U ; } for ( i = 1U ; i < dt -> Month ; i ++ ) { dt -> Day += ( u32 ) DaysInMonth [ i - ( u32 ) 1 ] ; } if ( ( dt -> Month > 2U ) && ( ( dt -> Year % 4U ) == 0U ) ) { dt -> Day ++ ; } Days = dt -> Day + ( 365U * dt -> Year ) + ( ( dt -> Year + 3U ) / 4U ) ; Seconds = ( ( ( ( ( Days * 24U ) + dt -> Hour ) * 60U ) + dt -> Min ) * 60U ) + dt -> Sec ; return Seconds ; }
This function translates time in YEAR:MON:DAY HR:MIN:SEC format to
 seconds.
This function translates time in YEAR : MON : DAY HR : MIN : SEC format to seconds .