Words by c.z.robertson

Timezones in Catkin

2003-09-30 05:54:56 UTC

Catkin is a blogging tool. It stores a list of date-stamped text. As such, it should be capable of handling dates. However, there's one aspect of dates that, until now, Catkin has been thoroughly unable to handle: timezones. I've just commited some code to CVS to rectify that situation.

So far, all Catkin's dates have been UTC. This is fine for me, but for anyone else, particularly those who don't live in the UK, it's not really adequate.

My first stab at timezones involved each blog having its own timezone, and all the dates would be displayed in that timezone. But the more I thought it the less that appealed. It wouldn't have worked for daylight saving time, nor for entries made from another location. So I decided that I wanted each entry to have its own timezone.

That pushed me up against the limits of the Date::Manip module which I'd been using for all the date processing in Catkin, so I switched to the DateTime modules instead. (There's talk in the Date::Manip documentation about plans to store timezones along with the dates, but that hasn't happened yet, and I'm not sure when it will.)

DateTime takes all its timezone information from the Olson database. Most of the timezones in that database are named by location. (I'm in the Europe/London timezone.) This means that the timezone is not a single offset from UTC. Instead it is a set of rules about the offset. The cool thing about this is that it means that Catkin can take care of daylight saving time automatically.

I have a little work to do to improve the UI for this feature. After that, I'll be pretty much ready to release Catkin 0.4.0.