Function to convert compiler macro __DATE__ and __TIME__ to a system time that can be used to initialize the CPU RTC. I use this to do a 1 time initialization of a RTC chip.
Dependents: xj-Init-clock-to-compile-time-if-not-already-initialized-ds1302
Parse compiler DATE and TIME into a time_t structure
I use this to initialize the system time RTC using set_time() to a value parsed from the DATE and TIME strings. I find it easier to recompile and reload the firmware than it is to manually type the time string.
Sample Use
https://developer.mbed.org/users/joeata2wh/code/xj-Init-clock-to-compile-time-if-not-alr extends the use of this library to set the DS1302 clock chip to the compile time only the first time the utility runs. After that it detects a sentinel already stored in the clock chip and used the previously saved time.
Referenced:
- http://stackoverflow.com/questions/1765014/convert-string-from-date-into-a-time-t
- https://developer.mbed.org/users/petereiso/notebook/cc-time-functions/
- http://playground.arduino.cc/Main/DS1302
History
month was 1 digit to high
2016-05-07, by joeata2wh [Sat, 07 May 2016 02:06:11 +0000] rev 2
month was 1 digit to high
update to use MIT license
2016-03-30, by joeata2wh [Wed, 30 Mar 2016 14:49:56 +0000] rev 1
update to use MIT license
works on STM-F401RE
2016-03-28, by joeata2wh [Mon, 28 Mar 2016 05:55:29 +0000] rev 0
works on STM-F401RE