Other Parts Discussed in Thread: EK-TM4C1294XL
Tool/software:
A device I am interfacing with is expecting this format. Is there an easy way to get seconds since 1970?
Thanks
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.
Tool/software:
A device I am interfacing with is expecting this format. Is there an easy way to get seconds since 1970?
Thanks
Hi,
I don't think you can use the C library function time() to get the local time. I will suggest you use the RTC to keep track of time. There is an RTC example at C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate_calendar that you can reference. You can initialize the RTC with the local time and date and use the RTC to keep track of time even when the device is in hibernate mode. See below available options displayed on a terminal window that are supported by this example. If your device is connected to the network through Ethernet, it is also possible to get the initial time from a NTP server. Please run the example and get a feel for it. Ultimately, you can convert the calendar (DD:MM:YYYY and the current time) to a Epoch value that is relative to 1970.
Thank you very much. So I should create my own function to convert the date and time (already implemented on our device, as you suggest) to seconds since 1970?
Yes, I hope there is already some ready to use function doing the conversion if you Google it.