0 Members and 1 Guest are viewing this topic.

#### VinzC

• Regular Contributor
• Posts: 139
• Country:
• See you later, oscillator.
« 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

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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.

• 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

#### VinzC

• Regular Contributor
• Posts: 139
• Country:
• See you later, oscillator.
« 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.

• 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.

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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.

• 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.

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

#### VinzC

• Regular Contributor
• Posts: 139
• Country:
• See you later, oscillator.
« Reply #4 on: July 17, 2017, 07:57:44 AM »
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 ;-) .

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« Reply #5 on: July 17, 2017, 08:00:12 AM »
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

#### alm

• Super Contributor
• Posts: 1127
• Country:
« 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.

• 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.

#### NivagSwerdna

• Super Contributor
• Posts: 1065
• Country:
« 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.

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

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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.

• 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

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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

#### NivagSwerdna

• Super Contributor
• Posts: 1065
• Country:
« 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 »

#### Hero999

• Super Contributor
• Posts: 9380
• Country:
« 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.

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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

#### NivagSwerdna

• Super Contributor
• Posts: 1065
• Country:
« 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.

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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

#### hamster_nz

• Super Contributor
• Posts: 1293
• Country:
« 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.

#### hamster_nz

• Super Contributor
• Posts: 1293
• Country:
« 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.

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....

#### alm

• Super Contributor
• Posts: 1127
• Country:
« 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 ). So North Korea, which does not observe daylight savings, would be a valid pick.

#### Jeroen3

• Super Contributor
• Posts: 2660
• Country:
• Embedded Engineer
« Reply #18 on: July 18, 2017, 04:15:33 PM »

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

#### mc172

• Regular Contributor
• Posts: 155
• Country:
« 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.

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

#### NivagSwerdna

• Super Contributor
• Posts: 1065
• Country:
« 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)

#### Electro Detective

• Super Contributor
• Posts: 1059
• Country:
« 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

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

#### tggzzz

• Super Contributor
• Posts: 6128
• Country:
« 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.

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

#### Jeroen3

• Super Contributor
• Posts: 2660
• Country:
• Embedded Engineer
« Reply #23 on: July 18, 2017, 07:57:52 PM »
Don't forget to account for general relativity.

#### NivagSwerdna

• Super Contributor
• Posts: 1065
• Country:
« Reply #24 on: July 18, 2017, 08:28:26 PM »
Don't forget to account for general relativity.
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/

Smf