How many hours are there in a day? Twenty-four of course, except for
the couple of days a year when there's 23 or 25. Worse, which days
have odd hours changes every year, is unpredictable, and
is subject to the
whim
of local politicians, religious leaders, and
sporting events.
This fall's DST change happens at
50 different
times depending on your location.
It's a terrible way to keep time.
Daylight Savings Time is confusing enough for people but it plays hell with software. There's an Internet advertising company I'm intimately familiar with that used to lose significant money twice a year because of customer budget algorithms that assumed every day had 24 hours. Once a year customers would only spend 23/24 of their budget losing 4% revenue, and once a year they'd spend 25/24 of their budget requiring 4% refunds. Now fixed, I'm pretty sure, but fixing it isn't easy if you're calculating in local time. The solution for software is simple; do all calculations in Coordinated Universal Time. UTC doesn't do daylight savings, so every day has 24 hours. (Technically some days can be a second too long or short, but for most applications that error is small enough to be ignorable.) The easiest way to be sure you're doing UTC everywhere is to set your servers' timezones to UTC. You'll forever be confused when looking at log files, particularly since your own offset to UTC is changing with daylight savings, but with a desktop clock showing UTC you can usually puzzle it out. |