EmbeddedRelated.com
Forums

Daylight savings date identification over the net

Started by Dimiter_Popoff March 30, 2014
On 30/03/14 13:27, David Brown wrote:
> There are 12 months in a year (I'm assuming the modern western calendar here, of course).
Trap avoided :)
> There are 24 hours in a day.
Not today :)
> There are 60 seconds in most minutes. But every now and again, there is a leap second, meaning that there are some minutes with 61 seconds. There is no fixed pattern in this - it is based on > astronomical observations (whose fine details are chaotic), and decided on by some committee somewhere.
AFAIK is it astronomical measurements that determine when a leap second needs to be inserted. In at least one year, two were inserted.
Op Sun, 30 Mar 2014 15:31:49 +0100 schreef Tom Gardner:

> On 30/03/14 13:53, upsidedown@downunder.com wrote: >> On Sun, 30 Mar 2014 11:11:20 +0100, Tom Gardner >> 354, 365, 366, etc. completely culture dependant. > > That's a good example of the 10% rule for me. > I've never come across the 354; was it due to > the change from Julian to Gregorian calendar? >
The Islamic year has 354 and 355 days. The Jewish year has 353, 354, 355, 383, 384, or 385 days.
> >>> - how many months in a year >> >> 12 or 13 depending on culture. > > Precisely. Most people fail to get that one right. > > >>> - how many hours in a day >> >> usually 24 > > 23 today in the UK :) > >
-- Coos
On 30.3.2014 г. 13:11, upsidedown@downunder.com wrote:
> On Sun, 30 Mar 2014 12:22:10 +0300, Dimiter_Popoff <dp@tgi-sci.com> > wrote: > >> About every year when it comes to it I search some reasonable >> way to implement it and shortly after I give it upand go >> empty handed. > > There is no such thing !!
Apparently not, otherwise I should have managed to locate it by now... :-) I suppose I'll start some manual service next time some of our users complains (timezone has to be set manually - NTP is also invoked manually but no one complains about that). So far we have sales in only 5 countries so maintaining the data manually should be manageable. I suppose automatic timezone change on a spectrometer which often acquires a spectrum over more than a day will introduce a lot worse problems to the users though.... (the starting moment is recorded in UTC and the acquisition time is in seconds, with extensive dead time correction etc. attributes around it so the measurement will not be compromised but making all the considerations might be harder for the user than manually changing the timezone :D ).
> .... but who is going to update for your region ? Mr. Putin ?
Hopefully not, he has a lot less to say about things here since Bulgaria is part of NATO and the EU. A lot more than most people think though (we have not yet been told what happened to the giant network of KGB agents which used to officially run the country prior to 1989 - so they now run it unofficially, which is some sort of progress I suppose....). Dimiter ------------------------------------------------------ Dimiter Popoff, TGI http://www.tgi-sci.com ------------------------------------------------------ http://www.flickr.com/photos/didi_tgi/sets/72157600228621276/
On Sun, 30 Mar 2014 15:36:20 +0100, Tom Gardner
<spamjunk@blueyonder.co.uk> wrote:

>On 30/03/14 13:27, David Brown wrote: >> There are 12 months in a year (I'm assuming the modern western calendar here, of course). > >Trap avoided :) > >> There are 24 hours in a day. > >Not today :) > >> There are 60 seconds in most minutes. But every now and again, there is a leap second, meaning that there are some minutes with 61 seconds. There is no fixed pattern in this - it is based on >> astronomical observations (whose fine details are chaotic), and decided on by some committee somewhere. > >AFAIK is it astronomical measurements that determine >when a leap second needs to be inserted. In at least >one year, two were inserted.
While it was previously possible to add/remove 1 second twice a year, now there are 4 opportunities to do this each year. As far as I know, seconds have been added only once a year and the slowing down has recently been so slow that the time between additions have been several years.
On Sun, 30 Mar 2014 15:31:49 +0100, Tom Gardner
<spamjunk@blueyonder.co.uk> wrote:

>On 30/03/14 13:53, upsidedown@downunder.com wrote: >> On Sun, 30 Mar 2014 11:11:20 +0100, Tom Gardner >> <spamjunk@blueyonder.co.uk> wrote: >> >>> On 30/03/14 10:47, Simon Clubley wrote: >>>> On 2014-03-30, Dimiter_Popoff <dp@tgi-sci.com> wrote: >>>>> About every year when it comes to it I search some reasonable >>>>> way to implement it and shortly after I give it upand go >>>>> empty handed. >>>>> Does anyone know how do MS and Android devices do it? >>>>> Where do they look the date up? >>>>> Eventually I suppose I'll do some sort of service for >>>>> DPS devices myself but it would be >>>>> nice if there were something similar to NTP to use. >>>>> >>>> >>>> What's wrong with just using the timezone database ? >>> >>> Fine, provided you know location, can interpret the >>> database correctly(!) and can update the embedded >>> equipment when the rules change. >>> >>> Anything to do with calendars is 10% more difficult than >>> you thought. Recursively. >>> >>> Favourite questions for youngsters: >>> - how many days in a year >> >> 354, 365, 366, etc. completely culture dependant. > >That's a good example of the 10% rule for me. >I've never come across the 354; was it due to >the change from Julian to Gregorian calendar?
Thanks to Coos to bringing up the alternatives for the Islam and Jewish calendar, there is is quite a time, since I had to include these things in actual programs.
>>> - how many months in a year >> >> 12 or 13 depending on culture. > >Precisely. Most people fail to get that one right. > > >>> - how many hours in a day >> >> usually 24 > >23 today in the UK :)
and 25 h next autumn.
>>> - how many seconds in a minute >> >> 59, 60 or 61 depending on the leap second issue. > >I didn't realise 59 was even a possibility, but it >hasn't happened yet.
That has never occurred so far, might need a huge zunami.
>I understands why the earth's >rotation has slowed from a day being 6 hours, >but I don't see how it could speed up! > > >>> Clueless youngsters /usually/ get one of those right; >>> very few youngsters get them all right. >> >> You seem to be quite optimistic. > >They usually get 366 days in a year, during my >pause after they've said 365.
On 30/03/14 18:04, upsidedown@downunder.com wrote:
> On Sun, 30 Mar 2014 15:36:20 +0100, Tom Gardner > <spamjunk@blueyonder.co.uk> wrote: > >> On 30/03/14 13:27, David Brown wrote: >>> There are 12 months in a year (I'm assuming the modern western calendar here, of course). >> >> Trap avoided :) >> >>> There are 24 hours in a day. >> >> Not today :) >> >>> There are 60 seconds in most minutes. But every now and again, there is a leap second, meaning that there are some minutes with 61 seconds. There is no fixed pattern in this - it is based on >>> astronomical observations (whose fine details are chaotic), and decided on by some committee somewhere. >> >> AFAIK is it astronomical measurements that determine >> when a leap second needs to be inserted. In at least >> one year, two were inserted. > > While it was previously possible to add/remove 1 second twice a year, > now there are 4 opportunities to do this each year. As far as I know, > seconds have been added only once a year and the slowing down has > recently been so slow that the time between additions have been > several years.
After bothering to check, you are of course right. I suspect my error was based on remembering the occasions when they were added in July rather than January.
On Sun, 30 Mar 2014 15:31:49 +0100, Tom Gardner
<spamjunk@blueyonder.co.uk> wrote:

>On 30/03/14 13:53, upsidedown@downunder.com wrote: >> On Sun, 30 Mar 2014 11:11:20 +0100, Tom Gardner >> <spamjunk@blueyonder.co.uk> wrote: >> >>> - how many seconds in a minute >> >> 59, 60 or 61 depending on the leap second issue. > >I didn't realise 59 was even a possibility, but it >hasn't happened yet. I understands why the earth's >rotation has slowed from a day being 6 hours, >but I don't see how it could speed up!
Large earthquakes. http://www.space.com/11115-japan-earthquake-shortened-earth-days.html http://mpe2013.org/2013/05/04/why-do-earthquakes-change-the-speed-of-rotation-of-the-earth/ There are a number of very large quakes that are known to have shortened the day. However, the 8.9 in Japan produced a delta of only -1.8us and it's reasonable to expect that the rotational deltas produced by different quakes would be randomly distributed and thus would be expected largely to cancel. So a negative leap second is possible, but highly unlikely. Might happen if Earth happens to capture an asteroid - but then nobody would notice because they'd be too busy looking at the second moon. 8-) George
On 3/30/14, 6:11 AM, Tom Gardner wrote:
> > Favourite questions for youngsters: > - how many days in a year > - how many months in a year > - how many hours in a day > - how many seconds in a minute > Clueless youngsters /usually/ get one of those right; > very few youngsters get them all right. >
The big question here is WHICH "year", "month", "day", "hour", "minute" and "second". (Are we UTC, UT0, UT1, or something else for the fine scale, and which calendar for the coarse scale, as well as dealing with sidereal or solar periods). If you give poorly defined questions, of coarse you are going to get wrong answers, and I suspect that most of the "wrong" answers you get, would be right under a different definition. (For instance, some systems do not have leap seconds, or need to worry about Day light savings time).
On 30/03/14 19:21, Richard Damon wrote:
> On 3/30/14, 6:11 AM, Tom Gardner wrote: >> >> Favourite questions for youngsters: >> - how many days in a year >> - how many months in a year >> - how many hours in a day >> - how many seconds in a minute >> Clueless youngsters /usually/ get one of those right; >> very few youngsters get them all right. >> > > The big question here is WHICH "year", "month", "day", "hour", "minute" > and "second". (Are we UTC, UT0, UT1, or something else for the fine > scale, and which calendar for the coarse scale, as well as dealing with > sidereal or solar periods). If you give poorly defined questions, of > coarse you are going to get wrong answers, and I suspect that most of > the "wrong" answers you get, would be right under a different > definition. (For instance, some systems do not have leap seconds, or > need to worry about Day light savings time).
I would regard anybody that gave that answer as someone that had given a good sufficient answer. All too often I've had to /explicitly explain/ why some days are 23 hours long. That really ought to be have been recognised by /anybody/ that's experienced at least 20 such days! Anybody that calls themselves an engineer really ought to have heard of leap seconds. Then, if they ever need to, they can find out more detail. Months in a year? Knowing that 12 isn't the only answer is something that an inquiring intelligent educated well-rounded person ought to know.
On 30.03.2014 18:48, Dimiter_Popoff wrote:

> Apparently not, otherwise I should have managed to locate it > by now... :-)
There's the timezone database, and code libraries that use it quite successfully. People use and like that enough that some sleazebags with an astrological background (of all things) tried to gain a copyright stranglehold over it around 2011, to reap a profit. As a fall back, some C libraries also support a fancy domain-specific language that allows specifying the entire behaviour piled into the TZ variable. The key problem is the same in both cases: the whole DST nuisance, just like timezone handling in general, is a politically dominated pile of utter nonsense. Whatever solution you have will therefore, by default, be wrong the next time you need it because in the meantime some politician or other decided that the system needed "improvement" (as in: it wasn't quite boneheaded enough yet). So there's really nothing to be done about it but to maintain an automatic update service to distribute (a suitable subset of) the latest timezone DB to your devices. For devices that don't already need such an auto-updater, setting one up just for this would be highly questionable. And of course, their place of work may well prohibit such kind of net access for security reasons.
> I suppose automatic timezone change on a spectrometer > which often acquires a spectrum over more than a day will > introduce a lot worse problems to the users though....
IMHO the only approach that makes technical sense for any embedded device (here meaning: any device that's not running a full-service general-purpose operating system with user-installable software and always-on network access) is to _not_even_try_. I.e. refuse to admit that not just "daylight saving", but rather the entire concept of timezones other than UTC (or NTP, or GPS --- pick your poison) even exist. The only likely result from trying to handle this pile of nonsense is frustration. Scientific instruments had better use the only somewhat scientific time scale there is: number of second since {some point in time of your choosing.