Why working with Time (Zones) is your biggest Enemy as a Programmer

in #programming3 years ago (edited)

Everybody knows, that our globe is split into different time zones, there even are countries(like the USA) where depending on the state you're in it may be one hour ealier than on the other site of the country.

And by this point, you may have allready realized, how big of an issue this is for coders, because if your programm has anything to do with time you'll have a giant problem, having your programm work in every country on the planet. But this would still be fairly easy to do, you'd just have to add like a dropdown menu, to choose your time zone. But at this part it gets really difficult. Here's why:

Problem Number 1: Summer/Winter Time

In some countires, like Germany for example, when sommer comes along, we change our clocks by one hour which will then be changed again when winter comes along. This means, that depending on the time of the year in those specific countries, you may be one hour in the future compared to the other ones. But then the programmer will find out, that this happens at different times in different regions, meaning his code will get less and less obvious to read and understand and more and more errors are build in, which will just get even bigger, when the coder realises, that some countries go one our foward in time, while others do the exact opposite on the same day.

Problem Number 2: Countries who are half an our out of sync compared to others in their time zone

At this point, any programmer will freak out. there really are countries that are like half an hour later in time compared to others in the same time zone. So he'll also have to add special cases for these countires which makes the list even longer and more errors occure and everything just gets messy as hell.

Problem Number 3: Leap Second:

Because of the earth spin getting slower over time, scientists cam up with the idea to invent leap seconds. This means that every few years there'll be one minute that doesn't go 58,59,00 but 58,59,60,00 this means, you'll have to tell the Computer there's a second with 61 seconds and at this point, you should really just give up, because this will ruin everything.


In the end there's just one thing left to say, if you ever have to do any programming based on time, don't do it. Get some API from someone who was kind enough to post their code plublicly and give them the  appreciation they deserve.


Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase https://
3. Type re
Get Featured Instantly � Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness