Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 1 month ago.
RTC date and time adjustment during compile time
Hello,
Is there a way to automatically adjust DS1307 RTC date and time during compilation time. I mean can mbed compiler adjust it according to windows date-time?
As far as i know, it is possible to do it on Arduino platform.. Is it possible for mbed?
Thanks...
1 Answer
9 years, 1 month ago.
This prints the time and date on a pc terminal set at point of compiling.
Print system Time and Date
pc.printf("%s %s\n",__TIME__,__DATE__);
You could extract the values to set the RTC.
However you will need to test if the RTC has been set otherwise every reset will set the same time until you compile again.
Have a look here, may help to extract the data to the RTC:
http://www.keil.com/support/docs/1102.htm
pc.printf("SystemCoreClock %d %s %s\n",SystemCoreClock,TIME,DATE);
Gives the compile time,date.
posted by 08 Oct 2015