GameTonight, now with Event Times

I’ve updated GameTonight to show the time of the event. This is also included in the JSON API and Status Board output. No guarantees that the event times are correct, but they are faithfully represented from the data feed.

This is something that I put off for three years because I was having all sorts of weirdness with time calculations on my local machine vs. the server GameTonight is running on. Thanks to Joe and his incessant nagging constant encouragement, I slogged through the necessary debugging this morning and finally got things set.

I know enough to know that whenever you’re working with dates and times, you want to do everything in GMT then convert out to a local timezone as a very last step. I also know that you probably want your app code to run in GMT rather than looking at the server’s timezone.

In trying to be careful about doing these things right, I learned a bunch of things that didn’t work. Ultimately the issue was with how mktime(), gmmktime(), gmdate() and date() do or do not use the timezone declared for the app vs. the server’s timezone.

Pro tip: use these in pairs (gmmktime() goes with gmdate() while mktime() goes with date()) and create useful logging functions to test their output on various machines/servers. Or not, your mileage may vary.

This post is part of the project: GameTonight?. View the project timeline for more context on this post.