Skip to main content

Falsehoods programmers believe about time


Disclaimer: This is not my own collection!

I learnt a lot from different blog post about this 'famous' topic. Here is the list of some of the misconceptions and mistakes related to both calendar and system time:

All of these assumptions are wrong

  1. There are always 24 hours in a day.
  2. Months have either 30 or 31 days.
  3. Years have 365 days.
  4. February is always 28 days long.
  5. Any 24-hour period will always begin and end in the same day (or week, or month).
  6. A week always begins and ends in the same month.
  7. A week (or a month) always begins and ends in the same year.
  8. The machine that a program runs on will always be in the GMT time zone.
  9. Ok, that’s not true. But at least the time zone in which a program has to run will never change.
  10. Well, surely there will never be a change to the time zone in which a program hast to run in production.
  11. The system clock will always be set to the correct local time.
  12. The system clock will always be set to a time that is not wildly different from the correct local time.
  13. If the system clock is incorrect, it will at least always be off by a consistent number of seconds.
  14. The server clock and the client clock will always be set to the same time.
  15. The server clock and the client clock will always be set to around the same time.
  16. Ok, but the time on the server clock and time on the client clock would never be different by a matter of decades.
  17. If the server clock and the client clock are not in synch, they will at least always be out of synch by a consistent number of seconds.
  18. The server clock and the client clock will use the same time zone.
  19. The system clock will never be set to a time that is in the distant past or the far future.
  20. Time has no beginning and no end.
  21. One minute on the system clock has exactly the same duration as one minute on any other clock
  22. Ok, but the duration of one minute on the system clock will be pretty close to the duration of one minute on most other clocks.
  23. Fine, but the duration of one minute on the system clock would never be more than an hour.
  24. You can’t be serious.
  25. The smallest unit of time is one second.
  26. Ok, one millisecond.
  27. It will never be necessary to set the system time to any value other than the correct local time.
  28. Ok, testing might require setting the system time to a value other than the correct local time but it will never be necessary to do so in production.
  29. Time stamps will always be specified in a commonly-understood format like 1339972628 or 133997262837.
  30. Time stamps will always be specified in the same format.
  31. Time stamps will always have the same level of precision.
  32. A time stamp of sufficient precision can safely be considered unique.
  33. A timestamp represents the time that an event actually occurred.
  34. Human-readable dates can be specified in universally understood formats such as 05/07/11.

Comments

Popular posts from this blog

Solving PyCharm bug: "Python helpers are not copied yet..."

I have been using PyCharm Professional to run and debug Python code from my Windows machine to a remote Linux device. There are some other tools available for the same purpose (e.g. Python Tool for Visual Studio 2017). But in my opinion, PyCharm Professional stands out among its counterparts as it comes with a "All Batteries Included" setup. Once you configure remote Python interpreter in PyCharm, then it works out of the box. However, today after upgrading to PyCharm Professional 2018.2.1, I could not run my Python script on remote device. The execution always failed with below error - "Error running 'hello': Python helpers are not copied yet to the remote host. Please wait until remote interpreter initialization finishes." To solve this issue, I had to remove the ".pycharm_helpers " folder from the remove device and then restart PyCharm so that the folder is re-created and files are copied again. Here are the steps with comma

Customized Crosshair with OxyPlot charting library

I am using Oxyplot to draw heatmap for a WPF project and needed to draw a crosshair that moves according to user clicks. Since I couldn't find any good example or documentation on the topic, I made a small hack by using LineAnnotations and by over-riding Oxyplot mouse click event. Here is the sample code using WPF with MVVM pattern- MainWindow.xaml <Grid>         <oxy:Plot x:Name="CrossHairPlot">             <oxy:Plot.Axes>                 <oxy:LinearAxis Key="MyXAxis" Position="Bottom" IsZoomEnabled="False"/>                 <oxy:LinearAxis Key="MyYAxis" Position="Left" IsZoomEnabled="False"/>                 <oxy:LinearColorAxis Key="ZAxis" Position="Top" LowColor="Black"                                                                                      HighColor="White" PaletteSize="300">                     <G

Solving ‘Could not resolve host: github.com’ issue

Recently I ran into this issue while trying to clone one of my own repository from GitHub C:\GitHub\FS> git clone https://github.com/<username>/FS.git Cloning into 'FS'... fatal: unable to access 'https://github.com/<username>/FS.git/': Could not resolve host: github.com At first I thought that this could be due to some proxy setting. So I tried to unset it by executing below command - C:\GitHub\FS> git config --global --unset https.proxy But that didn’t fix the problem and I was still getting the same error. As it turned out later, the culprit was my VPN connection. Turning off the VPN fixed the issue. For the records, I was using ‘Surfshark’ on my Windows 10 laptop.