This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How stored date and time information?

On STM32F1 I need create a log with storing the EEPROM, any as

30.10.2015 17:30 temp, humidity, xx, xx ,xx
30.10.2015 17:45 temp, humidity, xx, xx ,xx

I wonder how to store time information?
I do not use Linux int32 (time_t) since 2038 is next door.

You can recommend a standardized format for storing time information in EEPROM?

Parents
  • As Per points out 32-bit 1970 Epoch numbers go out to 2106, many RTC implementation just deal with 1901 thru 2099 as it simplifies the leap year logic.

    Windows has a 64-bit format

    Doing calendering from any epoch isn't that complicated, though a lot of people do screw it up, and don't test their code, so you should always verify the corner cases on stuff you pick up off the internets.

    The 2038 thing is a bit of a red herring, sure some old crap is going to fail, but anyone putting any thought into things will be fine.

Reply
  • As Per points out 32-bit 1970 Epoch numbers go out to 2106, many RTC implementation just deal with 1901 thru 2099 as it simplifies the leap year logic.

    Windows has a 64-bit format

    Doing calendering from any epoch isn't that complicated, though a lot of people do screw it up, and don't test their code, so you should always verify the corner cases on stuff you pick up off the internets.

    The 2038 thing is a bit of a red herring, sure some old crap is going to fail, but anyone putting any thought into things will be fine.

Children
  • "many RTC implementation just deal with 1901 thru 2099 as it simplifies the leap year logic."

    The RTC tends to be the weak links. How to set the initial time. How to handle drift. How to handle leap years. Leap seconds. Time zones. Daylight savings. Over-the-air or networked protocols. Power failures/battery changes. Moving the device over a time zone boundary or date boundary. Logging when RTC was synchronized, and how much forward/backwards the time was corrected. How long the RTC may be allowed to operate standa-lone without synchronization. How to know if the supply voltage is high enough that the RTC operation can be trusted.

    There are so many assumptions that needs to be documented. So many things that has to be either ignored or supported/tested/documented/...

    The time stamps of the individual measurements aren't worth much if there isn't confidence in the time used by the RTC.