Holiday Programming

I’ve always enjoyed the combined creative and logical process of programming. But like so many other things, it’s not a priority over other, more necessary daily tasks.

So a summer holiday, with very little else to do is an ideal opportunity to create a tool I had an idea for last year. In my current role, I need to take into consideration operational hours of services (applications) and maintenance windows of the infrastructure on which they run. The sounds relatively easy but is complicated by the hours being specified in multiple timezones – as the users are typically global – and the maintenance window being in yet another timezone.

To determine if a global application will fit in a given maintenance window involves converting all the times to a single zone (not forgetting daylight savings) and interpreting the table to see if there is any overlap. This is time consuming and error prone.

So much better to display the data graphically, on a clock face. One segment can represent the operational hours, another segment the maintenance window and if the two overlap, then there is an issue, which you can see in a blink.

I was unable to find an existing tool to do this so I have written it (using C, Cairo graphics on Centos).

At the moment, the program prompts for a single range of hours, but an obvious enhancement is to read these from a file – and perform the necessary timezone conversion. However, the output will look the same and a couple of examples are shown below.

Example 1

Example 1



Example 2

Example 2

Example 1 shows an application which has operational hours from 15:00 to 20:00 and a supporting system maintenance window of 23:00 to 02:00.

Example 2 shows a slightly more realistic application which runs from 07:00 until 05:00 but relies on a database which is unavailable from 04:00 to 06:00.  The overlap shows the problem straight away.

It works for me, but whether it will survive in the wild is another question! Do doubt there will be feedback which will lead to enhancements, although maybe I’d need another holiday to make them.

BTW, the trickiest part of this was positioning the text around the outside of the clock face. The text reference point has to be moved as the angle (and characters) change. This still needs some tweaking and perhaps I need to look carefully at a variety of clock faces.

Leave a Reply

Your email address will not be published. Required fields are marked *