Reply by Don Y May 6, 20142014-05-06
Hi Dimiter,

On 3/30/2014 2:22 AM, Dimiter_Popoff 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?
Getting *a* date/time (UTC) is easy! It is then up to the devices themselves to adjust for "local conventions". They would have to periodically update their time zone tables based on geographic and legislative changes. E.g., here (US) there are regions of the country that do NOT observe savings time. And, there have been times when legislation has *altered* the observance of said time changes. In short, you can't code one solution and hope it will always work. Nor is there a "standard"/service that would provide this information to you. As a (non-portable) *hack*, you could query google for "current time" and "<location>" and parse the result. But, there's no guarantee that google will continue to support this query.
> 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.
Either allow them to submit a query to you similar to the google one outlined above; or, push updates to the time zone tables periodically (folks who don't connect to you "often enough" don't get the benefit of having the most recent tables) [BTW, this can also handle leap second scheduling] Personally, I find it easier to just maintain a monotonically increase count of "elapsed time" (since some arbitrary epoch) that devices use to know "what time it is". I can tweek the timebase dynamically to track "the passage of time" more accurately (i.e., so one "count", on average, corresponds to the time required for light to travel 299,792,458 meters) but always ensure that "future >= now >= past". How this notion of time is presented to the user is then completely arbitrary (i.e., defined by the application). So, the fact that user time exhibits "discontinuities" is an issue that the *user* deals with and not the device. [E.g., user could decide -- erroneously -- to set the time/date to Jan 2, 2035 4:23PM at THIS INSTANT! Is this "wrong"? Is setting your alarm clock "5 minutes fast" also *wrong*??]
Reply by Tom Gardner April 3, 20142014-04-03
On 03/04/14 04:31, Richard Damon wrote:
> On 4/1/14, 5:09 AM, Tom Gardner wrote: >> On 01/04/14 03:48, Richard Damon wrote: >>> Then why were there questions about seconds in a minute or hours in a >>> day, these are not calendar questions either. >> >> The number of hours in a day depends on the day of the >> year - hence calendar information is inherently required >> That is reflected in the API of software libraries; many >> default to a particular locale but allow you to set the locale. >> >> > Actually, if you look up the definitions of hours, and day, you should > find that for most reasonable definitions of "day", you will get that a > day is 24 hours (for earth) for EVERY day. It is only for this strange > beasty of a "calendar day", or something artificial like "wall clock > time" that we get the exception, and this strangeness. You also need to > add into the equation where you are talking about, as there are > locations which never to this shifting, and others that do it at other > times, so just having a calendar isn't good enough.
Oh good grief. If you want to play silly games with 'most reasonable definitions of "day"', then a terran "day" lasts /anywhere/ between 0 and 24 hours. To take merely the first line of the first google hit day noun 1. the interval of light between two successive nights; the time between sunrise and sunset from http://dictionary.reference.com/browse/day and consider anywhere in the arctic or antarctic.
>>>> Do you have any pointers to non-terran calendars? >>> >>> Here are some found with a bit of searching. >>> >>> https://home.comcast.net/%7Edoowopdon/klingon_history.htm >>> >>> http://www.marketaz.co.uk/StarTrek/Vulcan/calender.html >>> >>> http://calendars.wikia.com/wiki/Middle-earth_calendar >>> (well, this MIGHT be considered terran) >> >> Um, I was looking for something with at least a >> tiny basis in reality. >> >> >>> Of course, until we get to some other planet, or meet someone who has, >>> these will be be a bit academic. The "Working on Mars Time", was >>> interesting, while the period was short enough they really didn't get to >>> calendars, they did get to clocks. >> >> I suspected as much. >> >> >>> http://starwars.wikia.com/wiki/Galactic_Standard_Calendar >> >> Anything less fictional? Astrological calendars don't count! > > So, you say that just because you haven't meet the people using the > calendar it doesn't exist?
So you would give equal credibility to a nutter using a calendar based on the "ancient day" of 6 hours? (Because the earth's day was originally 6 hours long).
> At that point you need to accept that a > person may consider that there are always 12 months in a year, and even > that as far as they are concerned, always 24 hours in a day (they may be > from a place without DST).
Strawman argument - very revealing.
Reply by April 3, 20142014-04-03
On Wed, 02 Apr 2014 23:31:50 -0400, Richard Damon
<Richard@Damon-Family.org> wrote:

>On 4/1/14, 5:09 AM, Tom Gardner wrote: >> On 01/04/14 03:48, Richard Damon wrote: >>> Then why were there questions about seconds in a minute or hours in a >>> day, these are not calendar questions either. >> >> The number of hours in a day depends on the day of the >> year - hence calendar information is inherently required >> That is reflected in the API of software libraries; many >> default to a particular locale but allow you to set the locale. >> >> >Actually, if you look up the definitions of hours, and day, you should >find that for most reasonable definitions of "day", you will get that a >day is 24 hours (for earth) for EVERY day. It is only for this strange >beasty of a "calendar day", or something artificial like "wall clock >time" that we get the exception, and this strangeness. You also need to >add into the equation where you are talking about, as there are >locations which never to this shifting, and others that do it at other >times, so just having a calendar isn't good enough.
While the _mean_ solar day is exactly 24 hours or 86400 seconds, the actual solar time as measured by a sun dial or more scientifically using a telescope to detect when the sun is in south (actually in the meridian, depending on hemisphere) is not constant, but can vary nearly a minute, causing +/-20 minute cumulative difference between actual solar time and mean solar time twice a year and slightly smaller peaks in between. Before railroads and telegraphs, each city used their own mean solar time. There was a small village outside London with a naval observation, which their own local _mean_ solar time, which later became GMT (after changing definition from noon-to-noon to midnight-to-midnight :-).
Reply by Richard Damon April 3, 20142014-04-03
On 4/1/14, 5:09 AM, Tom Gardner wrote:
> On 01/04/14 03:48, Richard Damon wrote: >> Then why were there questions about seconds in a minute or hours in a >> day, these are not calendar questions either. > > The number of hours in a day depends on the day of the > year - hence calendar information is inherently required > That is reflected in the API of software libraries; many > default to a particular locale but allow you to set the locale. > >
Actually, if you look up the definitions of hours, and day, you should find that for most reasonable definitions of "day", you will get that a day is 24 hours (for earth) for EVERY day. It is only for this strange beasty of a "calendar day", or something artificial like "wall clock time" that we get the exception, and this strangeness. You also need to add into the equation where you are talking about, as there are locations which never to this shifting, and others that do it at other times, so just having a calendar isn't good enough.
>>> Do you have any pointers to non-terran calendars? >> >> Here are some found with a bit of searching. >> >> https://home.comcast.net/%7Edoowopdon/klingon_history.htm >> >> http://www.marketaz.co.uk/StarTrek/Vulcan/calender.html >> >> http://calendars.wikia.com/wiki/Middle-earth_calendar >> (well, this MIGHT be considered terran) > > Um, I was looking for something with at least a > tiny basis in reality. > > >> Of course, until we get to some other planet, or meet someone who has, >> these will be be a bit academic. The "Working on Mars Time", was >> interesting, while the period was short enough they really didn't get to >> calendars, they did get to clocks. > > I suspected as much. > > >> http://starwars.wikia.com/wiki/Galactic_Standard_Calendar > > Anything less fictional? Astrological calendars don't count!
So, you say that just because you haven't meet the people using the calendar it doesn't exist? At that point you need to accept that a person may consider that there are always 12 months in a year, and even that as far as they are concerned, always 24 hours in a day (they may be from a place without DST).
Reply by Tom Gardner April 1, 20142014-04-01
On 01/04/14 03:48, Richard Damon wrote:
> Then why were there questions about seconds in a minute or hours in a > day, these are not calendar questions either.
The number of hours in a day depends on the day of the year - hence calendar information is inherently required That is reflected in the API of software libraries; many default to a particular locale but allow you to set the locale.
>> Do you have any pointers to non-terran calendars? > > Here are some found with a bit of searching. > > https://home.comcast.net/%7Edoowopdon/klingon_history.htm > > http://www.marketaz.co.uk/StarTrek/Vulcan/calender.html > > http://calendars.wikia.com/wiki/Middle-earth_calendar > (well, this MIGHT be considered terran)
Um, I was looking for something with at least a tiny basis in reality.
> Of course, until we get to some other planet, or meet someone who has, > these will be be a bit academic. The "Working on Mars Time", was > interesting, while the period was short enough they really didn't get to > calendars, they did get to clocks.
I suspected as much.
> http://starwars.wikia.com/wiki/Galactic_Standard_Calendar
Anything less fictional? Astrological calendars don't count!
Reply by Richard Damon March 31, 20142014-03-31
On 3/31/14, 10:35 AM, Tom Gardner wrote:
> On 31/03/14 13:31, Richard Damon wrote: >> On 3/31/14, 4:48 AM, Tom Gardner wrote: >>> On 31/03/14 03:22, Richard Damon wrote: >> \>>> >>>> Except that in some domains all days are 24 hours long (or in one case >>>> all days are about 23 hours, 56 minutes, and 4 seconds long) >>> >>> Sure, but that is not everyday (or perhaps every semiyear!) >>> experience for the "man on the Clapham omnibus", whereas >>> 23/24/25 is (except '68-'70 in the UK!). >>> >> >> Actually every day IS about 23 hours, 56 minutes and 4 seconds long, IF >> you are dealing with Sidereal days. > > The original question was about calendars, and I'm not > aware of any calendars based on the sidereal day. >
Then why were there questions about seconds in a minute or hours in a day, these are not calendar questions either.
> But that could be another example of the "10% recursive"! > >>> If they can't get everyday experience right, there's no >>> point in considering the "subtleties"! >> >> If you are saying that Sidereal days aren't important because they >> aren't and "everyday experience", then neither are other than 12 months >> to a year. > > I haven't said that, of course. > >>> Unless you're thinking of non-terrestrial calendars, >>> you'll have to explain that one! >>> >> >> Yep, you were showing a Terran bias. > > Do you have any pointers to non-terran calendars? > >
Here are some found with a bit of searching. https://home.comcast.net/%7Edoowopdon/klingon_history.htm http://www.marketaz.co.uk/StarTrek/Vulcan/calender.html http://calendars.wikia.com/wiki/Middle-earth_calendar (well, this MIGHT be considered terran) Of course, until we get to some other planet, or meet someone who has, these will be be a bit academic. The "Working on Mars Time", was interesting, while the period was short enough they really didn't get to calendars, they did get to clocks. http://starwars.wikia.com/wiki/Galactic_Standard_Calendar
Reply by WangoTango March 31, 20142014-03-31
In article <lh8nne$2p3$1@dont-email.me>, dp@tgi-sci.com says...
> 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. > > Dimiter >
I'm sure they just keep the RTC running GMT or local standard time and just adjust for DLS by massaging that data and NOT messing with the RTC, but that may be too much for a small MCU to handle on the fly. I have done it the "bad" way, which can drift the clock a few seconds per year, on top of the clock's drift, depending on how fast you can pull it all off. I have a DLS flag held in the RTC's free battery backed RAM and I check the time and date against that flag and actually update the RTC accordingly. I wrote a set of routines to check if the date and time falls inside the DLS period and go from there. I saw one implementation that just hard coded the next 10 years of DLS dates and times in a lookup table and adjusted the RTC accordingly. I do have one product that I just don't do it, the owner just adjusts the time when they go to collect the cash in the unit. Which is usually weekly.
Reply by Tom Gardner March 31, 20142014-03-31
On 31/03/14 18:20, Simon Clubley wrote:
> On 2014-03-31, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote: >> On 2014-03-31, Tom Gardner <spamjunk@blueyonder.co.uk> wrote: >>> >>> Do you have any pointers to non-terran calendars? >>> >> >> Yes. There's the calender as used on Mars.
If it isn't in the tz database, it doesn't exist. Bah. Oh, if you insist :)
> And before someone thinks I've lost the plot :-), Google for > > NASA living on Mars time > > (and similar search strings) > > at which point you will find NASA employees have some direct experience > of living by a Mars calender. :-)
Must try and get some astrologers to define what it means to have "Earth in the ascendent" and not "Mars in the ascendent" :) And it that's astrological gibberish, then... ... how can anybody tell? (No. I'm not going to google it. On principle.)
Reply by Simon Clubley March 31, 20142014-03-31
On 2014-03-31, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
> On 2014-03-31, Tom Gardner <spamjunk@blueyonder.co.uk> wrote: >> >> Do you have any pointers to non-terran calendars? >> > > Yes. There's the calender as used on Mars. >
And before someone thinks I've lost the plot :-), Google for NASA living on Mars time (and similar search strings) at which point you will find NASA employees have some direct experience of living by a Mars calender. :-) Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
Reply by Simon Clubley March 31, 20142014-03-31
On 2014-03-31, Tom Gardner <spamjunk@blueyonder.co.uk> wrote:
> > Do you have any pointers to non-terran calendars? >
Yes. There's the calender as used on Mars. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world