Testing time

One of the fun things about daylight savings time is the need to test your code around the times it changes.

"Time is an illusion, lunchtime doubly so"

Douglas Adams

Firstly let us be clear time does not go backwards or jump forwards in daylight savings … time itself just ticks on like it usually does … the only thing that changes is that the representation of time on the clock changes.

Unfortunately many of the libraries we use do not make it absolutely clear about how they relate to system time and representational time. After all if you live in most places in the world there are only a couple of hours that are affected…

Perhaps we need a way to test this and other changes like leap years … and if it were convenient then we might actually do this regularly


Python Serving HTTPS with CGI

One of the claims often made about Python is that it is so easy to extend the language and change the behaviour of an object. The classic example of this is turning the standard library http server into an https server. Unfortunately, although there are hundreds of examples on the web about how to do this - made even more numerous by the move to Python 3 - days of testing here failed to get them to work with CGI scripts. Ordinary pages worked fine, but CGI would fail silently. Apparently these same examples worked on PCs.

The problem turned out to be a quite subtle implementation difference between the Mac and Unix handling of CGI processes and the PC approach in the Python library. Read More...