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.
Well, this is useful: http://t.co/z8WKoOy2pF
Is traffic being affected by a game tonight?
Via @alexkingorg
@zamoose @alexkingorg This is useful for me. As a non-sports fan, I always get caught in sports traffic. Needs to add New Orleans.
@plagiarismtoday Saints and Pelicans – sure, will look at adding them. /cc @zamoose
@alexkingorg I think you can skip the Pelicans. Nobody goes to their games… (I’m kidding, mostly) @zamoose
@alexkingorg Where are you pulling game tonight data from?
At least there’s no Unicode.
What have you got against ????, Joe?
Shawn, I love how you illustrated Joe’s point when I look at the imported comment over on Alex’s blog: http://d.pr/i/M9V4