Now Reading
Falsehoods programmers consider about time zones

Falsehoods programmers consider about time zones

2024-02-13 11:35:53

My aunt has an issue

She loves becoming a member of Zoom conferences, however they’re all hosted in numerous time zones. It is arduous to recollect if she ought to add 4 hours, subtract 3, or what. She’s not probably the most technical individual, so google is not an possibility. She has to ask for assist.

Each. Single. Time.

And, for the much less technically minded, it is also error-prone.

It acquired me pondering:

What if occasion organizers might share a hyperlink that might do the give you the results you want? If somebody clicked on mytime.at/5pm/EST, they’d see their native model of that point. It sounded easy sufficient.

I started coding.

I later found mytime.io had already carried out a really comparable factor, and run into the identical pitfalls

I knew making an attempt to handle time is a fool’s errand, however that is what datetime libraries are for. I might merely construct an additional time zone conversion layer on high.

Certainly that could not be sophisticated

…Proper?

I quickly found simply how mistaken I used to be. One after one other, I saved studying the falsehood of yet one more “truth” that had appeared clearly true. Ultimately my authentic imaginative and prescient grew to become actually not possible to drag off with out making severe compromises (extra about that in a future weblog submit).

Hopefully this checklist will allow you to keep away from the landmines I stepped on. All of the falsehoods beneath are ones I would thought-about true sooner or later in my grownup life.

Most of them I believed only one month in the past.

False impression #1: UTC offsets go from -12 to +12

Seems, UTC offsets span from -12 to +14. Yeah, +14. That is offers you 27 hours UTC will be offset by (do not forget the zero offset)

How does it work? UTC-12 has the identical time as UTC+12, however is sooner or later behind. Similar goes for UTC-11 and UTC+13, and many others.

Why that loopy vary? That was a results of pacific islanders determined they needed to be on a selected aspect of the worldwide date line.

It makes for a really jagged worldwide date line

False impression #2: Each UTC offset corresponds to precisely one time zone

Listed below are 10 distinct time zones that are all at UTC+5:

  • Aqtobe Time
  • Mawson Time
  • Maldives Time
  • Oral Time
  • Pakistan Commonplace Time
  • French Southern and Antarctic Time
  • Tajikistan Time
  • Turkmenistan Time
  • Uzbekistan Time
  • Yekaterinburg Time

You is likely to be questioning: in the event that they’re all on the identical UTC offset, why couldn’t all these international locations simply use the identical time zone? Maybe Pakistanis weren’t eager about being on “Yekaterinburg Time”

False impression #3: There are extra international locations on this planet than time zones

How might this one presumably be mistaken? Nicely…

  1. Many international locations need their very personal time zone (what number of do you suppose run on Myanmar Time?)
  2. Some international locations cut up themselves up into a number of time zones (e.g. japanese and western instances)
  3. Navy time alone makes use of 25 time zones, one for every hour from UTC-12 to UTC+12
  4. DST. Extra on this one beneath

All collectively, there are 244 time zones utilized by the 195 international locations on this planet.

False impression #4: Each time zone has precisely one agreed upon identify

Ever discover how each time zone consists solely of English phrases? Awfully type of Spanish and French talking international locations to graciously use our language, proper?

Hah, Yeah proper.

Jap Commonplace Time, Tiempo del Este, and Heure Normale de l’Est are all completely different names for the very same time zone.

Have enjoyable coding that into your library.

False impression #5: Time zones are at all times offset from UTC by an integer variety of hours

India customary time is 5 and a half hours off of UTC. There are lots of extra examples

False impression #6: Superb, time zones are at all times offset from UTC by an integer variety of half-hours

Nepal likes to be on the 45 minute UTC offset.

Why does that additional quarter-hour matter a lot to them? As a result of they really want their mountain to have the solar proper above it at midday.

Nevertheless it makes you surprise: what would occur if the mountain ever shifted?

False impression #7: A rustic stays on the identical UTC offset all yr lengthy

Do not forget about Daylight Saving Time! Or because the Europeans name it “Summer season Time.”  

International locations working towards DST change their UTC offset twice yearly.

False impression #8: There’s a customary format for declaring time zones

Hah, I want. Listed below are some requirements I found, there could also be extra:

Widespread identify

These are the normal time zone names we’re used to. Instance: Pacific Commonplace Time.

However I do not know if there’s an official time period for these names, they simply that unstandardized.

IANA zone keys

That is as near the official customary as you will get. It is in no way official, however it’s one thing the developer group has rallied round.

It is a painstakingly maintained database which incorporates all recognized time zone knowledge representing the whole historical past of native time for locations across the globe.  It would not give any zone a reputation although, preferring to make use of the identify of probably the most outstanding metropolis in there, which ends up in:

Outstanding metropolis primarily based

This one is “basically bad UI that derives from the IANA zone keys

Full time zone names include naming issues, which we mentioned above. If that wasn’t sufficient enjoyable, there’s additionally the political implications of recognizing sure time zones reminiscent of Israel Commonplace Time.

Some builders took the safer route and recognized time zones solely by the identify of a outstanding metropolis in it, not bothering to map it to a standard identify. That is why the Ubuntu time zone picker makes you choose “New York” as an alternative of Jap Commonplace Time.

Overlook time zones, use the uncooked UTC offset

W3’s worldwide customary gave up on the notion of time zones and declared that engineers ought to solely retailer a timestamp’s raw UTC offset.

GPS Coordinates

Enjoyable truth: Many APIs for getting a area’s UTC offset solely need a UTC time and latitude/longitude coordinates. This lets them outline any second unambiguously and never have to fret about Daylight Saving Time.

In case you squint your eyes a bit, you could possibly contemplate this a fourth customary.

False impression #9: Daylight Saving Time begins on the identical time yearly

Did you suppose this may be the one factor world powers agree on? Every nation select when to start out it is personal DST

False impression #10: A rustic’s time zone by no means modifications

Nearly yearly some nation will go a regulation to edit their time zone.

In a very memorable instance, just a few years in the past the Samoan islands needed to be on the opposite aspect of the worldwide date line to get the identical weekends as their Australian buying and selling companions. So on midnight Dec twenty ninth, they modified their UTC offset from -11 to +13 UTC, skipping Dec thirtieth and going straight to Dec thirty first.

Samoan residents had one much less day to have a good time the vacations that yr.

On the plus aspect, simply 40 miles away the American Samoa Islands stayed on the opposite aspect of the worldwide date line. Now Samoans can have a good time new years on the Western Island, after which boat over to American Samoa for a second new yr’s celebration the following night time.

False impression #11: A rustic stays in the identical time zone throughout Daylight Saving Time

Humorous factor about DST, it would not truly change the time zone’s UTC offset.  As an alternative, Daylight Saving Time international locations swap to a special time zone, with a special identify.

For instance:

Texas goes from Central Commonplace Time to Central Daylight Time.

Chile goes from Chile Commonplace Time to Chile Summer season Time

False impression #12: Daylight Saving Time begins round March and ends round October

The Southern hemisphere has their summer time within the different half of the yr. The sample flips.

False impression #13: Each time zone has it’s personal identify

Which nation ought to get to say “Jap Commonplace Time”?

North America claimed dibs by advantage of inventing the identify, however do you suppose nobody objected? Australia thought it appeared like a high-quality identify to make use of, and so though the remainder of the world discuss with their time zone as Australian Jap Commonplace Time, some of it is personal residents simply name it “Jap Commonplace Time” (not all of them call it that though).

False impression #14: Each time zone has its personal abbreviation

Which of those was meant when somebody says CST?

  • Central Commonplace Time
  • China Commonplace Time
  • Cuba Commonplace Time

And keep in mind how the time zone identify modifications throughout Daylight Saving Time? Many individuals don’t know that and maintain utilizing the mistaken abbreviations throughout DST months. CST is likely to be used for Central Daylight Time.

If there isn’t any customary identify for time zones, can you actually anticipate one for the abbreviations?

False impression #15: There’s at all times an unambiguous conversion from one time zone to a different

If I say I need to convert 5pm Jap Commonplace Time to Pakistan Commonplace Time, am I speaking concerning the American or Australian Jap Commonplace Time?

And is Daylight Saving Time in impact or not?

Okay, it’s difficult. However certainly if we embrace the date and the precise metropolis, then we would be able to do the conversion reliably, proper?

What if the date and time are 1:30 am on Nov 1st, 2020, proper when US DST ends and the clock strikes backwards?

1:30am happens twice that morning, how have you learnt which occasion was supposed?

False impression #16: Your time zone library can acknowledge any time zone (you’re utilizing a library for this, proper?)

Keep in mind all these completely different potential time zone names and codecs? Most libraries will solely help one.

They usually is likely to be restricted by the point zones put in in your native machine.

Yeah, actually.

Keep in mind, if time zones can change primarily based on the whims of an area authorities, then the library will want some exterior dataset to base its calculations off of. That exterior dataset simply is likely to be the time zones put in in your PC.

False impression #17: All the nation at all times shifts throughout Daylight Saving Time

Within the US, Arizona would not follow Daylight Saving Time

False impression #18: All the state at all times shifts throughout Daylight Saving Time

Inside Arizona, the Navajo Nation fortunately follows Daylight Saving Time

False impression #19: Aside from DST, each metropolis inside a state follows the identical time zone

In Indiana, USA, most cities observe Jap Commonplace Time however just a few determined to observe Central Commonplace Time

False impression #20: Each metropolis sits inside precisely one time zone

A couple of instances in historical past, state line or time zone lies acquired drawn with out listening to who truly lived on that border, reducing a metropolis in half.  There are a surprisingly large number of examples.

This permits some actually uncommon sleep schedules

It’s also why GPS coordinates are extra dependable than metropolis names to find out the time zone

False impression #21: There’s a chosen time zone for each location on this planet

The north and south poles don’t have any official time zone. Researchers there simply observe their very own nation’s time.

There is no manner that might get complicated.

False impression #22: This can be a complete checklist of misconceptions

These are the misconceptions I’ve uncovered to date, however I am positive there are numerous extra ready to be found. Heck, I did not even understand UTC offsets went all the best way as much as +14 till simply 10 hours earlier than I revealed this checklist!

False impression #23: Redditors will agree these are all misconceptions

Who am I kidding? Reddit by no means agrees on something. Severely although,  this submit sparked a conversation which highlighted just a few extra misconceptions I would held. Thanks Reddit!

A number of the highlights:

  • #24: Daylight Saving Time begins and stops precisely as soon as annually: When the month of Ramadan begins, some Muslim international locations will exit DST time, after which re-enter DST as soon as Ramadan ends.  It makes sundown (the time to finish your quick) arrive sooner (by way of matthieum)
  • #25: DST offsets are at all times precisely one hour: The Lord Howe island makes use of a 30 minute DST offset (by way of paulrpg), and England as soon as had a 2 hour DST offset (by way of bandwidthcrisis)
  • #26: Commonplace Time is similar as Time Zone: They’re different concepts (and apparently I have been utilizing them mistaken this entire article :P) (by way of lpsmith)
  • #27: Timezones are at all times offset from UTC by an integer variety of quarter-hours: Amsterdam was as soon as on the UTC + 19 minute, 32.13 second offset. Many of the world simplified it to UTC+0:20 (by way of DJDavio)
  • #28: Everybody follows their official time zone: Some western components of China have their very own unofficial time zone (by way of jl2352), and a few industries independently resolve to disregard DST to mitigate the timezone insanity (by way of bitchkat)
  • #29: You may clear up your issues by saving the time as UTC: Saving future timestamps in UTC can still lead to confusion (by way of AryA_ch)
  • #30: Delivery dates let you know who’s older:  Not necessarily (by way of oshkarr)
  • #31: There are precisely 195 international locations on this planet: Not precisely time zones however one other false impression (by way of kankyo)
  • #32: When you’ve got a UTC timestamp and the GPS coordinates, you’ll be able to at all times decide the native time: Palestine and Israel have completely different time zones. So within the West Financial institution, the time zone depends on if you’re Palestinian or an Israeli settler. If you do not know which individual you are computing the time zone for, the native time is ambiguous (by way of haxney)
  • #33: Historic UTC offsets for a area by no means change: The 1927 time zone shift for Shanghai has been adjusted at least twice since July 2011 (by way of JoeIngeno)
  • #34: Daylight Saving Time is the one timezone adjustment: Generally international locations as an alternative transfer their clocks backwards within the Winter and name it Winter Time (by way of Radek Zajic)

Wish to hear about how I designed the time zone mission, labored across the obstacles, balanced commerce offs, what I lastly ended up constructing?

Enroll beneath to get that essay as soon as it is prepared.



Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top