Here's a fun bozo move to try when you're giving a presentation: Change your timezone when giving a demo that involves time sensitive data.
I was giving my pre-conference Intro to AJAX technologies session at ASP.NET Connections yesterday. One of the demos was a small demo that showed a simple chat client ( oh yes an example of what not to do with AJAX <g> ). So essentially you can type text into a one browser window and be able to see it in one or more other windows. Not a great practical example, but a good demonstration of the technology.
Anyway – it's been working just fine when I was testing things the night before. Day of the presentation though – a complete blowup! Type in a message and the message ends up in the middle of some old messages and updates repeatedly are bringing back old messages, flooding the chat display. Hardly the expected result.
Well, it turns out that I ended up changing the time zone between the last tests I ran and the presentation. I had put the machine into current time here in Orlando, and then had set it back to Hawaii time at a later point in time.
Now here's why this really freaked me out. I AM in fact using Utc dates to store the time values but it STILL failed! Huh?
As it turns out the problem is that IIS doesn't recognize the timezone change unless restarted. So although my time values were getting saved in UTC time format the fact that IIS's time was out of sync with the rest of the system was causing the mismatch. So SQL Server and IIS were actually seeing different timezones. Still not quite sure why this should be a problem for UTC time values, but it sure was...
It was pretty strange running a Web page and displaying a DateTime value at the top (all the samples in this session show the render timestamp) that's showing a different time than the system time. It didn't quite occur to me in the middle of the talk that IIS needed to be reset.
Anyway… next time I do a presentation I'll be sure to remember to do an IISRESET before. It's a good idea to do this anyway I suppose.
Other Posts you might also like