cancel
Showing results for 
Search instead for 
Did you mean: 

How to know on RTC date after a specific number (stm32f401)

miracaydogan
Associate II
Posted on October 31, 2016 at 16:27

For example :  My date  is  31.10.2016  . After  120 days later,  what is my new date ? 

Is it possible to know it on internal RTC module or  maybe calculation??    (STM32F401)  

#rtc
2 REPLIES 2
Posted on October 31, 2016 at 16:44

You'd need to compute based on established day, month, year relationships.

The RTC hardware is a relatively simple implementation, but doesn't provide a method to do math on the settings.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jpeacock23
Associate III
Posted on November 01, 2016 at 03:03

There are several ways to perform date arithmetic.  Search on Julian date for examples of handling date only math.

Another alternative is to use the C runtime functions in time.h.  Convert date and time to a 32-bit seconds since fixed date, add offset in seconds and then convert back to date and time in BCD.  Look at the mktime() and gmtime() methods.

  Jack Peacock