Rtc seconds count not updating
The other way to encode an instant is as a data structure, with fields representing years, months, days, hours, minutes, seconds, and subseconds.
With a certain amount of computing energy, it is possible to translate an instant from the offset encoding to the structured time encoding.
So if the only reason we're not doing translation between formats is available processor time, offset format is something that doesn't need to be translated very often.
My suggestion, therefore, is that of them store time in a calendar structure.
The basic idea is this: You hook up a crystal oscillator that has a frequency such that 1 second is exactly 2 cycles for some value of N.
The MC146818, for example, takes 32.768k Hz crystals (N=15) as well as 1.048576MHz (N=20) or 4.194304MHz (N=24).
This way, if you read all the fields of the current time in one SPI transaction, they're an atomically-consistent snapshot of the time when the chip select was lowered. Sometimes it's difficult to get a processor to do this, because it has to do The Dance with other chips, and it doesn't have time to read 6 or 7 bytes in one shot.
Very few store time as a relative offset, and none that I've found allow you to use both.
So we throw up our hands, and buy a real-time clock chip that stores time in a calendar structure, and write the grungy code (or use someone else's) to convert time to/from the relative offset format for dealing with intervals between instants.
(And don't forget: not all time zones have integer hour offsets from UTC: Venezuela, India, Afghanistan, and Iran all have half-hour offsets, and Nepal and some islands of New Zealand have 45-minute offsets.
So don't constrain your users to integer-hour time zone offsets.)Otherwise it can get confusing: many areas observe a 1-hour shift in time for part of the year ("Daylight Savings Time" in the US).