http://opalkelly.com/

Author Topic: About time zones...  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

Offline VinzC

  • Regular Contributor
  • *
  • Posts: 132
  • Country: be
  • See you later, oscillator.
About time zones...
« on: July 16, 2017, 11:37:14 PM »
I've just watched Dave's EEVBlog2 (World Time Zones explained).

If that sounds interesting, developers should never attempt at writing code for managing time zones though. You'll find why in an excellent video made by (Tom Scott, Computerphile).
« Last Edit: July 17, 2017, 12:29:13 AM by VinzC »
 
The following users thanked this post: SeanB

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #1 on: July 17, 2017, 12:34:17 AM »
Anything to do with time and dates is more difficult than you imagined. And that includes recursion.

Let's start with simple questions:
  • how many milliseconds are there in a second?
  • how many seconds are there in a minute?
  • how many minutes are there in an hour?
  • how many hours are there in a day?
  • how many days are there in a month?
  • how many months are there in a year?
  • how many years are there in a century?
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline VinzC

  • Regular Contributor
  • *
  • Posts: 132
  • Country: be
  • See you later, oscillator.
Re: About time zones...
« Reply #2 on: July 17, 2017, 07:17:27 AM »
Anything to do with time and dates is more difficult than you imagined. And that includes recursion.

Let's start with simple questions:
  • how many milliseconds are there in a second?
  • how many seconds are there in a minute?
  • how many minutes are there in an hour?
  • how many hours are there in a day?
  • how many days are there in a month?
  • how many months are there in a year?
  • how many years are there in a century?
Well, the answer is simple. It just depends on where you are and when you ask the question.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #3 on: July 17, 2017, 07:46:07 AM »
Anything to do with time and dates is more difficult than you imagined. And that includes recursion.

Let's start with simple questions:
  • how many milliseconds are there in a second?
  • how many seconds are there in a minute?
  • how many minutes are there in an hour?
  • how many hours are there in a day?
  • how many days are there in a month?
  • how many months are there in a year?
  • how many years are there in a century?
Well, the answer is simple. It just depends on where you are and when you ask the question.

Assume here and now. What's your answer?
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline VinzC

  • Regular Contributor
  • *
  • Posts: 132
  • Country: be
  • See you later, oscillator.
Re: About time zones...
« Reply #4 on: July 17, 2017, 07:57:44 AM »
Assume here and now. What's your answer?
Define "here" and "now"? Is it your "here" or mine? Is it the "now" you typed the question or the "now" I'll post the reply? Shall I account for the propagation delay and the case my reply takes more than 4 months (and I switch to winter time). Hmmm... I need a couple of weeks to reply ;-) .
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #5 on: July 17, 2017, 08:00:12 AM »
Assume here and now. What's your answer?
Define "here" and "now"? Is it your "here" or mine? Is it the "now" you typed the question or the "now" I'll post the reply? Shall I account for the propagation delay and the case my reply takes more than 4 months (and I switch to winter time). Hmmm... I need a couple of weeks to reply ;-) .

All valid, but none of that changes the answers :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online alm

  • Frequent Contributor
  • **
  • Posts: 671
  • Country: 00
Re: About time zones...
« Reply #6 on: July 18, 2017, 12:47:07 AM »
All valid, but none of that changes the answers :)
Of course it does. Some places observe daylight savings, others do not.

Anything to do with time and dates is more difficult than you imagined. And that includes recursion.

Let's start with simple questions:
  • how many milliseconds are there in a second?
  • how many seconds are there in a minute?
  • how many minutes are there in an hour?
  • how many hours are there in a day?
  • how many days are there in a month?
  • how many months are there in a year?
  • how many years are there in a century?
Assuming we are talking UTC (so no daylight savings or politicians changing timezones):
  • 1000 milliseconds in a second
  • 59, 60 or 61 seconds in a minute (leap seconds)
  • 60 minutes in an hour
  • 24 hours in a day (may be 23 or 25 if daylight saving is observed)
  • between 27 and 31 days in a month.
  • 12 month in a year*
  • 100 years in a century
What pitfalls did I miss (step into)?

*) assuming Gregorian year. A year as part of an ISO 8601 week date may last until January of the next Gregorian year and may have 13 or maybe even 14 (partial) months.
 

Online NivagSwerdna

  • Frequent Contributor
  • **
  • Posts: 741
  • Country: gb
Re: About time zones...
« Reply #7 on: July 18, 2017, 01:02:12 AM »
I would recommend against using UTC, the length of the day varies considerably during the year due to the earth's rotation varying. 

I would advise https://en.wikipedia.org/wiki/Barycentric_Dynamical_Time

 ;)

PS
1000 milliseconds in a second
Nothing wrong with that statement... in fact it is the definition of a milli.   1000 milliaardvarks in an aardvark
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #8 on: July 18, 2017, 02:13:11 AM »
All valid, but none of that changes the answers :)
Of course it does. Some places observe daylight savings, others do not.

Anything to do with time and dates is more difficult than you imagined. And that includes recursion.

Let's start with simple questions:
  • how many milliseconds are there in a second?
  • how many seconds are there in a minute?
  • how many minutes are there in an hour?
  • how many hours are there in a day?
  • how many days are there in a month?
  • how many months are there in a year?
  • how many years are there in a century?
Assuming we are talking UTC (so no daylight savings or politicians changing timezones):
  • 1000 milliseconds in a second
  • 59, 60 or 61 seconds in a minute (leap seconds)
  • 60 minutes in an hour
  • 24 hours in a day (may be 23 or 25 if daylight saving is observed)
  • between 27 and 31 days in a month.
  • 12 month in a year*
  • 100 years in a century
What pitfalls did I miss (step into)?

In the UK, 1752 had 10 fewer days. I've heard tales that the tax year boundary used to be the equinox, and rather than change the amount of tax gathered, they kept the tax year the same length. Currently the tax year boundary is April 5th/6th.

Practically you have to include DST; hence 23/24/25 is correct.

Different definitions of days and lunar months, of various types - but they aren't part of the calendar.

Quote
*) assuming Gregorian year. A year as part of an ISO 8601 week date may last until January of the next Gregorian year and may have 13 or maybe even 14 (partial) months.

How narrow minded and parochial; a common fallacious assumption :)

One calendar has up to 19 months of 19 days - plus a 4 or 5 days that aren't in months.
« Last Edit: July 18, 2017, 02:20:31 AM by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #9 on: July 18, 2017, 02:17:32 AM »
I would recommend against using UTC, the length of the day varies considerably during the year due to the earth's rotation varying. 

Sometimes UTC is precisely the most appropriate definition of time; it all depends on how you are using time.

Quote
1000 milliseconds in a second
Nothing wrong with that statement... in fact it is the definition of a milli.   1000 milliaardvarks in an aardvark

Not quite as simple as that. Leap seconds are added/subtracted at convenient instants, not when a definition of time has shifted by 1000ms.

There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online NivagSwerdna

  • Frequent Contributor
  • **
  • Posts: 741
  • Country: gb
Re: About time zones...
« Reply #10 on: July 18, 2017, 04:06:48 AM »
Not quite as simple as that. Leap seconds are added/subtracted at convenient instants, not when a definition of time has shifted by 1000ms.
Seconds are always 1000 milli-seconds long by definition.  Indeed Seconds are well defined too... 9192631770 periods.... Cs133.... etc.
Leap seconds are a human thing to keep their time in sync with the rotation of the planet they are on.   Indeed the extra seconds are added where convenient in order to keep UT1 and UTC   reasonably close together (DUT1).  When an extra second is added... it is always the same size as the others and its likewise 1000 as big as 1/1000th of a second.

I'm not saying your seconds appear to be as long as mine.... since it's all relative. (and depends on our velocity/gravitational effects etc).    ;)
« Last Edit: July 18, 2017, 04:08:48 AM by NivagSwerdna »
 

Online Hero999

  • Super Contributor
  • ***
  • Posts: 7848
  • Country: gb
Re: About time zones...
« Reply #11 on: July 18, 2017, 04:15:36 AM »
Not quite as simple as that. Leap seconds are added/subtracted at convenient instants, not when a definition of time has shifted by 1000ms.
Seconds are always 1000 milli-seconds long by definition.  Indeed Seconds are well defined too... 9192631770 periods.... Cs133.... etc.
Leap seconds are a human thing to keep their time in sync with the rotation of the planet they are on.   Indeed the extra seconds are added where convenient in order to keep UT1 and UTC   reasonably close together (DUT1).  When an extra second is added... it is always the same size as the others and its likewise 1000 as big as 1/1000th of a second.

I'm not saying your seconds appear to be as long as mine.... since it's all relative. (and depends on our velocity/gravitational effects etc).    ;)
It's pretty daft measuring time, to any degree of accuracy, in anything but seconds or milliseconds. The calender can easily be modified by using satellites to measure the earth's position, relative to the moon and the sun.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #12 on: July 18, 2017, 06:01:18 AM »
Not quite as simple as that. Leap seconds are added/subtracted at convenient instants, not when a definition of time has shifted by 1000ms.
Seconds are always 1000 milli-seconds long by definition.  Indeed Seconds are well defined too... 9192631770 periods.... Cs133.... etc.
Leap seconds are a human thing to keep their time in sync with the rotation of the planet they are on.   Indeed the extra seconds are added where convenient in order to keep UT1 and UTC   reasonably close together (DUT1).  When an extra second is added... it is always the same size as the others and its likewise 1000 as big as 1/1000th of a second.

I'm not saying your seconds appear to be as long as mine.... since it's all relative. (and depends on our velocity/gravitational effects etc).    ;)

You appear to be confusing durations with calendars. They are fundamentally different and incompatible, despite their using similar units. And therein lies a lot of the complexity :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online NivagSwerdna

  • Frequent Contributor
  • **
  • Posts: 741
  • Country: gb
Re: About time zones...
« Reply #13 on: July 18, 2017, 07:31:23 AM »
You appear to be confusing durations with calendars. They are fundamentally different and incompatible, despite their using similar units. And therein lies a lot of the complexity :)
Hm... well I'm certainly not disputing that calendars are confusing... they involve popes and emperors.  But they are defined by epoch and duration thereafter so I think they are most certainly related.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #14 on: July 18, 2017, 08:08:44 AM »
You appear to be confusing durations with calendars. They are fundamentally different and incompatible, despite their using similar units. And therein lies a lot of the complexity :)
Hm... well I'm certainly not disputing that calendars are confusing... they involve popes and emperors.  But they are defined by epoch and duration thereafter so I think they are most certainly related.

Simple example... A one second duration (number of times an ion has waggled its tail) can finish an >hour later than it started, e.g. 00:01:59.5 to 03:00:00.5 Or, of course, finish before it started.
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 1107
  • Country: nz
Re: About time zones...
« Reply #15 on: July 18, 2017, 02:44:06 PM »
Practically you have to include DST; hence 23/24/25 is correct.

Which brings me to my favorite time zone - Troll time (yes, I kid you not - look in /usr/share/zoneinfo/Antartica) - it has +1 and +2 hour Daylight Saving, so you can have two short days and two long days in a year.

 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 1107
  • Country: nz
Re: About time zones...
« Reply #16 on: July 18, 2017, 02:54:51 PM »
I would recommend against using UTC, the length of the day varies considerably during the year due to the earth's rotation varying. 

I would advise https://en.wikipedia.org/wiki/Barycentric_Dynamical_Time

 ;)

PS
1000 milliseconds in a second
Nothing wrong with that statement... in fact it is the definition of a milli.   1000 milliaardvarks in an aardvark

Well there goes a few more hours on Wikipedia and in the more obscure corners of the Interweb....
 

Online alm

  • Frequent Contributor
  • **
  • Posts: 671
  • Country: 00
Re: About time zones...
« Reply #17 on: July 18, 2017, 03:00:30 PM »
Practically you have to include DST; hence 23/24/25 is correct.
Why? Look at this map. If you are in any of the light or dark gray countries, then you would not observe daylight saving, and hence a day would be 24 hours (unless politicians mess with the daylight savings, which is incidentally why I picked UTC which does not observe daylight savings either). You refused to specify location, so to me that means the person answering the question can assume any location they wish (I imagine implied that it should be on earth :P). So North Korea, which does not observe daylight savings, would be a valid pick.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 2256
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: About time zones...
« Reply #18 on: July 18, 2017, 04:15:33 PM »

Posted on 2017-07-18T06:16:44+00:00
 

Offline mc172

  • Regular Contributor
  • *
  • Posts: 87
  • Country: gb
Re: About time zones...
« Reply #19 on: July 18, 2017, 06:43:00 PM »
Simple example... A one second duration (number of times an ion has waggled its tail) can finish an >hour later than it started, e.g. 00:01:59.5 to 03:00:00.5 Or, of course, finish before it started.

 :o Eh? Please explain, I'm curious to understand!
 

Online NivagSwerdna

  • Frequent Contributor
  • **
  • Posts: 741
  • Country: gb
Re: About time zones...
« Reply #20 on: July 18, 2017, 07:14:36 PM »
Hm... 59682F00 doesn’t really seem worth celebrating

I'm holding out for Wed Dec 25 05:01:21 GMT 2041.  It's even Christmas Day.

(PS Although I can understand the obsession humans have for base 10)

 

Online Electro Detective

  • Frequent Contributor
  • **
  • Posts: 663
  • Country: au
Re: About time zones...
« Reply #21 on: July 18, 2017, 07:16:34 PM »
.
If you can fit one of these in the shed, time zones are not a problem  >:D



« Last Edit: July 19, 2017, 06:15:17 PM by Electro Detective »
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 5138
  • Country: gb
    • Having fun doing more, with less
Re: About time zones...
« Reply #22 on: July 18, 2017, 07:47:00 PM »
Simple example... A one second duration (number of times an ion has waggled its tail) can finish an >hour later than it started, e.g. 00:01:59.5 to 03:00:00.5 Or, of course, finish before it started.

 :o Eh? Please explain, I'm curious to understand!

Remember what happened on Sunday, 26 March 2017 at 01:00?
And will happen on Sunday 29 October at 02:00, in the UK?
There are lies, damned lies, statistics - and ADC/DAC specs.
Gliding aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 2256
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: About time zones...
« Reply #23 on: July 18, 2017, 07:57:52 PM »
Don't forget to account for general relativity.  |O
 

Online NivagSwerdna

  • Frequent Contributor
  • **
  • Posts: 741
  • Country: gb
Re: About time zones...
« Reply #24 on: July 18, 2017, 08:28:26 PM »
Don't forget to account for general relativity.  |O
What do they say?  A man with one watch always knows the time, a man with....

How about a man with six atomic clocks in the back of his car? http://www.leapsecond.com/great2016a/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf