In our applicant tracking product, we had a close date by which candidates must apply for the job. Early on there was a bug due to timezone handling where the job would close an hour too early. No big deal one would think - the job is open for weeks, maybe months, so who cares if it closes at 11pm on the last day instead of midnight? It turns out that a lot of people live their lives by the "last minute" principle. T…
Navigating the timezone nightmare in product development
41–50 of 65 posts
Re: Navigating the timezone nightmare in product development
#42Common mistake that I don't think the author got right either, is that if you want something to happen at a future local time time, say 2PM in São Paulo at some date next year, you don't use UTC + a timezone, you use local time + timezone. Timezones are not immutable, and timezone database updates happen every year. Only if you track dates that happen in the past UTC makes sense. In some cases/jurisdictions they chan…
I think this case is sufficiently complicated that we can't simply declare that the author got this wrong and that you should always use local time + timezone. What if that local time zone changes its DST rules to completely skip over that 2pm? Can we really confidently say that the user's intention when scheduling that event was that the event should be skipped if such a time zone change occurs between now and then?
Re: Navigating the timezone nightmare in product development
#43Date and time handling in software is one of the most dramatic examples of software being a means of communication between humans and machines. What appears to be a seemingly basic physical process turns out to demand reams of code to manage leap years, leap seconds, time zones, the birth of Christ and that of Unix, Gregorian and Julian calendars, and worst of all: daylight saving time (DST). DST was once supposed to…
Re: Navigating the timezone nightmare in product development
#44Date and time handling in software is one of the most dramatic examples of software being a means of communication between humans and machines. What appears to be a seemingly basic physical process turns out to demand reams of code to manage leap years, leap seconds, time zones, the birth of Christ and that of Unix, Gregorian and Julian calendars, and worst of all: daylight saving time (DST). DST was once supposed to…
It involved:
- the day of the week (office closed on weekends)
- day of the year, with leap years (office closed during holidays)
- Easter day (some holidays are based on Easter)
- DST and timezones (office hours are in local time, timestamps are UTC)
Thankfully, no Julian calendar or leap seconds to deal with.
Re: Navigating the timezone nightmare in product development
#45Re: Navigating the timezone nightmare in product development
#46Earlier quoted context omitted.
Another detail about dates people often forget or don't know (though it's not usually important), is that a "date" can be 50 hours long. Let's say you want to have some sale to occur all day on Christmas, midnight to midnight in your customer's local time. For easier math let's say your business is in GMT tz. People in the Line Islands (Pacific/Kiritimati) will have access to the sale 14 hours before yourself. Then t…
> the UTC+12 timezone is completely uninhabited New Zealand would like a word.
Re: Navigating the timezone nightmare in product development
#47There's quite a few other non-slash-having names out there:
ls -pL /usr/share/zoneinfo | grep -v '/'
"Eire" is in there, for instance, to deal with software that assumes that the "is_dst" half of the year is during the (northern) summer, but Ireland technically does it the other way around -- a distinction relevant only to computers.https://github.com/eggert/tz/blob/c3e966c59b02b1f47f0b7b0e4a...
The only other timezone that currently has a non-1h offset for DST -- Ireland's is -1 hours -- is Australia/Lord_Howe, which has a 30-min positive leap.
Edit: there are also tzdb entries of the form "a/b/c" -- America/Kentucky/Louisville --- though they are not commonly used in practice.
Re: Navigating the timezone nightmare in product development
#48Date and time handling in software is one of the most dramatic examples of software being a means of communication between humans and machines. What appears to be a seemingly basic physical process turns out to demand reams of code to manage leap years, leap seconds, time zones, the birth of Christ and that of Unix, Gregorian and Julian calendars, and worst of all: daylight saving time (DST). DST was once supposed to…
- Instant - a point in monotonously increasing time (Unix timestamp is usually a good enough approximation for most cases)
- Calendar
- Wallclock - non-monotonous human-readable clock
Being precise about which entity is used is enough to resolve most of the confusions.
For example, scheduling a doctor appointment is always Calender + Wallclock in a location of doctor's office. No Instant should be used to record this, and changing of DST rules for this location shouldn't affect the appointment. DST rules only matter if we want to convert from one Calendar and Wallclock to the other, then Instant may be used internally in calculations.
Back to the article: if we are talking about subscriptions, then we should specify, if subscription is valid for time interval of 365*24*60*60 seconds or the expiry is tied to Calendar+Wallclock, but in this case Calendar+Wallclock should have a specific location. The first option is much easier to implement, and to avoid any timezone/DST frustration adding an extra day of subscription (366 instead of 365) will be enough.
Re: Navigating the timezone nightmare in product development
#49Earlier quoted context omitted.
So what do you do, record both the local time and UTC?
IMO the way to avoid insanity is explicit modeling, the pain comes from where different code was written with different beliefs about what the value "really means." For example, if there's a lunchtime event in Bizarro São Paulo you record "Noon in Bizarro Brazil Time" or even ("Noon in whatever timezone that office building will exist in") because it really does depend on the rhythm of the city. In contrast, if it's…
Re: Navigating the timezone nightmare in product development
#50Earlier quoted context omitted.
And when you interact with people 8 time zones away, concepts like "today" or "tomorrow" break down completely . It's a very uncanny feeling.
I remember having a call with two colleagues once, I was in Sydney, one colleague was in london and one in LA It was quite surreal, although time wise I think the LA person was up early on Tuesday and I was up late.
I now have an app that runs continuously in my menu bar to track all the different time zones that I care about. Tel Aviv and Tokyo also figure into the equation sometimes.