1.25.17.8 RTC_TimeSet Function

C

bool RTC_TimeSet( struct tm *time )

Summary

Sets the Time for the RTC peripheral.

Description

This function updates the time for RTC peripheral as configured by the user.

Precondition

None.

Parameters

Param Description
time Pointer to struct tm

Returns

True if Valid Time and/or Date is configured, False otherwise.

Example

struct tm dateTime;
//Hour
dateTime.tm_hour = 12;
//second
dateTime.tm_sec = 0;
//Minute
dateTime.tm_min = 34;
//Month
dateTime.tm_mon = 11;
//Year
dateTime.tm_year = 2017;
//day of the month
dateTime.tm_mday = 14;
//day of the week
dateTime.tm_wday = 1;
RTC_TimeSet( &dateTime );

Remarks

The structure can be deleted once the API returns to free up the memory