The Martian clocks (keeping Martian time) on the page also display the Ls (pron. ell sub ess) - a way of describing where the planet is in its orbit1), and the displacement of the sun in the sky at midday. I noticed the value for this was out by some distance, and after pondering the problem (and the code) for a while, the penny dropped.
Unfortunately, the code was still generating a value that was out by 1/100th of a degree, which isn't much but it bothered me. It turned out to be due to a rounding issue, so I fixed that. Ls is now displayed to five decimal places. This value matches that generated by Mar24, a program available from the Goddard Institute for Space Studies, a branch of NASA.
For Earth, Ls advances approximately one degree per day (~0.9863°), but for Mars with its more eccentric orbit, things don't work out quite so neatly. Some Martian months are as short as 46 sols, while others are as long as 67 sols, so months are not determined by dividing the sols per year by 12. A new month begins when the planet reaches an increment of 30° around its orbit. Since Ls determines where in the orbit it is, it is the only viable way of determining what the current month is.
I also corrected the text on the same page, where it stated the Martian day was 39m 53s longer than a standard day on Earth, when it should have said 39m 35.2s. I don't know what I was thinking