Co[de]mmunications

Programming and ramblings on software engineering.

It's a Time Zone Change in Shanghai

See this page for details of 1927 in Shanghai. Basically at midnight at the end of 1927, the clocks went back 5 minutes and 52 seconds. So “1927-12-31 23:54:08” actually happened twice, and it looks like Java is parsing it as the later possibly instant for that local date/time - hence the difference.

Just another episode in the often weird and wonderful world of time zones.

Besides illustrating how difficult dealing with time is, this is a textbook example of why estimations really are guesstimations. I am certain that Freewind spent a good deal of time trying to solve this problem before submitting it to Stack Overflow. In any project of considerable size, you run into these road bumps. Even though you know how of a workaround, it is worthwhile to find the root cause and solve problems in a clean manner instead of polluting systems with ad-hoc fixes. Given enough time, any quick-fix will come back to haunt the maintenance programmer.

Comments