Time, again!

Mike Olson
3 min readDec 23, 2022

A while ago, I wrote a longish post about a clock I built to keep metric time. I promised I was going to polish it up, build a case for it and make a pretty piece of desk furniture out of it.

I haven’t done that yet.

Instead, I made a couple of different versions of that clock, using different sources for the authoritative time signal, different display tech and so on.

I also thought it would be interesting to keep track of metric time based not just on the local time zone, but also according to the actual position of the sun in the sky.

The moment that the sun is at its highest in the sky varies, of course, based on where you are on the planet. It turns out that it’s more complicated than that, though. The Earth’s orbit around the sun is elliptical, not perfectly circular, and that means that noon (and midnight!) move around a little bit during the year.

I had a fun time rat-holing on that topic. There’s something called the equation of time that captures the variation. You carefully measure the exact instant that the sun’s overhead at the prime meridian and note what your accurate UTC clock tells you the time is. That difference is the “equation of time” for that day.

Curve showing the “equation of time” value for days over the course of the year.
Equation of time over the course of the year. Image credit: User Drini, CC-BY-SA 3.0, at https://en.wikipedia.org/wiki/Equation_of_time#/media/File:Equation_of_time.svg

That’s not too handy, of course, because you have to spend a lot of time standing on the prime meridian, looking up. What you really want is a formula that spits out the right number, based on the date.

Researchers at NASA’s Jet Propulsion Laboratory did that hard work for a long stretch, and then came up with a formula that does what you want. They plotted a curve of the EoT values over the course of the year, used a Fourier analysis to break that curve down into its components, and then used linear regression to determine coefficients for each of those components. The result is a pretty simple mathematical function to implement. It tells you how far off solar noon is from UTC noon. The function is accurate to within 13 seconds for any hour of any day in the current century.

If you know your longitude, you can do some simple math to compute the current solar time from the EoT and current time at UTC.

So of course I coded that up!

Once I had a working implementation of that function, I decided to add solar metric time to my earlier clock project. I once again use a real-time clock circuit for accuracy. I sync that RTC periodically (once every 50 days, for my DS3231, as it is accurate to two parts per million) via the NTP server at NIST. I still dislike smart devices on my home network, but it just turns out to be so easy and reliable, and the technique works world-wide (unlike the WWVB signal) and far away from windows (unlike GPS).

Here’s what that looks like on a breadboard:

Electronics breadboard with three 4-digit 7-segment LED displays, a real-time clock circuit and a pushbutton switch, with wires connecting the components to an Arduino Uno Wifi Rev2 board. The three displays read “6175”, “6246” and “14:59”.
Breadboard solar metric clock

The upper left display shows solar metric time (6175). The lower left display is local metric time (6246, so right at that moment at my house solar noon lagged metric noon by 71 hundred microdays). It was interesting to see — it makes total sense if you think about it — that the two metric clocks turn over their digits at different times. The lower right display is the current local hh:mm time (14:59).

If you’re interested in the Arduino build, check out the project hub.

This was fun! I discovered that some Arduino libraries are built for specific chipsets on the different Arduino boards, and if you mix and match, the software can fry the board. I am glad to know that, though not so happy to have spent a bit more than $100 on the lessson. I’ve always been a bit of a maps nerd and a bit of a time nerd, so knowing about the equation of time and including longitude in my what-time-is-it arithmetic delivers both those kinds of dopamine hit.



Mike Olson

Berkeley-based techie with an interest in business. Worried about the world.