Re: Is there an easy way to implement daylight saving changes?

On Mon, 31 Oct 2011 12:47:18 +0000, Peter <nospam@xxxxxxxxxxxxxx> wrote:

I have developed a product which has a Dallas DS1302 RTC.

Given the application, it would be nice if one could automatically
implement the daylight saving change.

A bit of googling digs out a lot of material including the whole lump
of code from Linux, but it is quite big and I am running out of ROM

I am sure this must be an FAQ...

Is there some simple way of doing it?

Obviously one needs to have a user-configurable setting for the
timezone; there are about 30 of those. Assuming one stores *local*
time in the RTC (which in this case I can do) one just needs to store
the start and end dates for the daylight saving period, and the time
offset. If OTOH one is setting the RTC to GMT (as one would be if
using e.g. a time server) then one needs to store the GMT-local offset
as well.

All in all, there is a huge potential for subtle bugs in all this, and
a lot of code which can never be tested properly.

My take would be that it depends almost entirely on the undisclosed
nature of the product. If it's a consumer grade item (digital camera,
microwave oven, automatic thermostat) don't bother, just make it easy
for the end user to set their desired time. If it's for something where
the time really matters, use UTC unless there are similar products
and/or a common expectation in the target community for a specific time
model. Also, leap seconds.

Once you go down the path of automatically correcting for DST, you'll
need to give the end user the ability to apply updates to the rules. Not
having automatic DST changes is a very minor annoyance, since that is
how most consumer grade products behave. On the other hand, having the
time change incorrectly (and unexpectedly) is much worse.

Rich Webb Norfolk, VA