Electronics > Projects, Designs, and Technical Stuff
If you get to choose, which type of RTC chip would you prefer to use?
technix:
I have been using RTC chips in projects, and so far I have seen two types of those: most chips uses a calendar representation internally, and from time to time there is a chip that uses a binary counter as RTC. Which type do you prefer?
In my opinion I would prefer a binary counter, as it allows me to use UNIX time directly on it, without any regard to nuances like time zones, leap seconds etc. This also allows easy use with various library functions since the RTC returns time_t directly.
AndersJ:
I appologize for hijacking your thread,
but I can’t resist now that you mention ”time_t”.
Assuming you refer to the time type in C,
what is the correct/preferred way to interface
the RTC to the C library that uses time_t?
RoadRunner:
--- Quote from: technix on February 04, 2020, 06:24:35 am ---I have been using RTC chips in projects, and so far I have seen two types of those: most chips uses a calendar representation internally, and from time to time there is a chip that uses a binary counter as RTC. Which type do you prefer?
In my opinion I would prefer a binary counter, as it allows me to use UNIX time directly on it, without any regard to nuances like time zones, leap seconds etc. This also allows easy use with various library functions since the RTC returns time_t directly.
--- End quote ---
I would certainly prefer binary for the same reason you mention. It allows UNIX time stamp which make its really easy to handle with standard lib functions. When I implement a firmware with those old BCD RTC I always handle time as Unix time stamp throughout the system and just convert into UNIX time stamp and back only by two function on the driver layer. So if I have binary RTC it would save hassle of fetching BCD and getting time stamp outof it.
From where I see those old BCD RTC were initially meant for dumb digital clocks and for system who have really low processing power. Firmware or digital logic would have directly fetch date and time and without any calculation would have put onto a dumb display.
I would still not touch any STM32 mcu though.
Regards
magic:
Those "smart" RTCs are used in PC computers and have problems with tricky edge cases like time zones, leap seconds and DST. Any sophisticated software still needs to know a thing or two about timekeeping and correct the RTC's internal logic every now and then.
I like the UNIX system of counting time in seconds and only converting to calendar date for UI purposes.
iMo:
--- Quote ---If you get to choose, which type of RTC chip would you prefer to use?
--- End quote ---
DS3231SN
Navigation
[0] Message Index
[#] Next page
Go to full version