Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

Flickr
www.flickr.com
RobMiles' items Go to RobMiles' photostream
Twitter
C# Yellow Book

Search entire site
« Funny Way to Run a Railway | Main | One Hundred Followers on Twitter. But Why? »
Wednesday
Apr012009

Live Code at the Humber Bridge

The clocks changed on Sunday morning. In the UK we started British Summer Time, which meant that a sinister government plot resulted in 60 minutes of my life being stolen overnight. We had to put the clocks forward of course. One year I tried to assert my independence from this time base tyranny, but it didn’t work that well, and I was late for everything (or early, I forget).

Anyhoo, many years ago I wrote some software for the Humber Bridge that is part of their toll management system (Ian and Nicky did the rest) and my bit is in charge of making sure that the clocks get put forward and back. Because the software had to go quite quickly I implemented a little look-up table with the dates hard wired into the code. And then I forgot all about it.

Of course this weekend my little table ran out, and today I got a call from Neil at the bridge because their system was living in the past. So it was out with the Windows 95 system that I used to create the software, a quick extension of the table and down to the bridge to install it.

We use a system by Siemens to talk to PLC machines in the Toll Booths. It has a wonderful ability to let you update the code while everything is running. This is because the software is designed for process control, where you sometimes can’t turn everything off just to put new versions out there. So I was able to add the new code (which I’d already tested on my laptop) and then watch as the clock pinged forward to the correct hour.

The table now works to 2012. I’ve set an appointment in my diary to remind me to get in touch with them well before then, so that it doesn’t happen again.

Reader Comments (3)

Does it run out on December 21st 2012? If so, then thats a bad omen...
April 2, 2009 | Unregistered CommenterJoel
Hardcoding it line by line seems a bad way to code yet a great way to get a Christmas bonus every 4 years...

I have to wonder why windows 95 doesn't put the clock forward automatically, and why it's so vital to have the correct time... I'd have thought receipts would simply print the system time. Or something.
April 6, 2009 | Unregistered CommenterSimon
I'm not particularly proud of the hard coding. I originally wrote a version that was automatic but I pulled it out and replaced it with a lookup to try and resolve some timing problems.

The installation is presently a bit beyond the planned lifetime and the system actually doesn't use any computer system clocks at all, reading the time value off a GPS system so that it is always very accurate.
April 6, 2009 | Registered CommenterRob

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.