This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
The C6000 compiler (I'm using v6.1.15) provides the time.h functions like clock(), strftime(), etc. That's good, but on an embedded system they won't have the proper time when the system powers up, and I don't see any way of initializing the time and date.
Is there a method of initializing date and time for the run-time system time.h library functions?
--Randy Yates
Please see the recently posted Wiki article http://processors.wiki.ti.com/index.php/Time_and_clock_RTS_Functions .
Thanks and regards,
-George
Hi George,
Thank you for taking the time to respond. I actually found the answer myself just yesterday.
It wasn't clear to me at first glance (if I've used the time.h functions at all, it's been quite a few years), but the "root" source of time for the date/time functions is the time_t, which is the number of seconds since Jan 1, 1900, 00:00:00. That is passed to the other functions such as localtime().
So all one has to do is to maintain their own, properly initialized value of time_t.
--Randy