Blogity blog blog

This is my weblog. I write about projects and stuff I build in my spare time, be it code or tinkering with physical objects. You can find out more about me on my homepage.

What time is it?

Can there be a question much simpler than this? And yet, when I had to answer this question in a little piece of code some days ago, little did I know what i was getting into.

Of course, time and dates are confusing and although they were about the first thing to be measured with contraptions and automata, their units are simply too human (read: insane) for machines:

Our units of temporal measurement, from seconds on up to months, are so complicated, asymmetrical and disjunctive so as to make coherent mental reckoning in time all but impossible. Indeed, had some tyrannical god contrived to enslave our minds to time, to make it all but impossible for us to escape subjection to sodden routines and unpleasant surprises, he could hardly have done better than handing down our present system. It is like a set of trapezoidal building blocks, with no vertical or horizontal surfaces, like a language in which the simplest thought demands ornate constructions, useless particles and lengthy circumlocutions. Unlike the more successful patterns of language and science, which enable us to face experience boldly or at least level-headedly, our system of temporal calculation silently and persistently encourages our terror of time. (…)

It is as though architects had to measure length in feet, width in meters and height in ells; as though basic instruction manuals demanded a knowledge of five different languages. It is no wonder then that we often look into our own immediate past or future, last Tuesday or a week from Sunday, with feelings of helpless confusion.

— Robert Grudin, Time and the Art of Living (1982)

And to add insult to injury, there are timezones. Don’t get me wrong: I fully understand the concept of different times in different places. On the Internet, however, we should stick to Greenwich Mean Time. They don’t call it “Coordinated Universal Time” for no reason — and to keep with the theme of making things unnecessarily confusing, Coordinated Universal Time is abbreviated as UTC.  When I read that the reason for that was that the name is given in English and the abbreviation is given in French, I gave up trying to understand it. I already had more than my share of craziness at that point.

The tricky thing about timezones is that they pop up when you wouldn’t expect them. In my case it was in the FireEagle API. When calculating when a position in FireEagle was last changed, I thought that I could get the delta by just substracting the timestamp of the last FireEagle entry from the current time (GMT/UTC). How naive of me! OF COURSE, FireEagle logs its data in Californian time, being a Yahoo! company effort… This means I first have to find out what time it is in California right now and then convert that to GMT:

Pacific Standard Time (PST), the timezone California is located in, is 8 hours behind of Coordinated Universal Time (UTC). But then again, that would be too easy. To make life more interesting, man has invented Daylight Saving Time. And to make that even more interesting, some really arcane rules were attached to that. Here’s an excerpt:

It probably goes without saying that these rules when DST begins are entirely different in other timezones, say in Europe — just to make things even more interesting. A question as simple as “What time it is?”, a question you could ask a first-grader, suddenly becomes really, really complicated, once you have to tackle it with a computer…




Comments (View)
blog comments powered by Disqus