Most of us have some sort of digital clock at home, like this one:

It’s a pretty nice invention. Yet when you think about it, it’s pretty inefficient.

Most digital clocks run on twelve hours, making no distinction between AM and PM. Since there are sixty minutes in an hour, and a digital clock ‘cycles’ every twelve hours, there are only 12*60 or 720 possible times that a digital clock can display.

Ignoring the two dots in the middle separating the hours and the minutes, there are four numbers shown in the display. Each of the four numbers use a *seven-segment display*:

In total there are 4*7 or 28 individual LED’s comprising the digital clock (again ignoring the two dots). But there are only 720 possible times to display.

This means there is a good deal of redundancy. With 28 LED’s or 28 bits of information, you can display one of 2^28, or 268435456 possible times. Except that only 720 of them are valid.

Theoretically, only ten LED’s are needed for a digital clock, and being able to display one of 1024 messages, they are adequate for our means. A hypothetical ten-LED clock might look like this:

This solution is not entirely satisfactory, however. Since 720 is not a power of two, 304 of the 1024 possible values are invalid. Then seemingly arbitrary combinations of dots are valid, while others are not. This is not an elegant solution.

### A triangular clock

Notice, however, that 720 is a perfect factorial: it is the product of the first six numbers. We can take advantage of this fact and design a triangular digital clock.

Instead of using a base ten numbering system that humans use, or a base 60 system of seconds and minutes or the base two (binary) system used by computers, we are going to use the Factorial number system, which is a mixed radix system.

This enables us to encode times like this:

To decode it:

The dots in the rows are worth 360, 120, 30, 6, and 1 minutes respectively. Adding them up results in 671, which is to be interpreted as 11*60+11, or 11:11.

This works because a dot in a row is worth one more than the sum of *all *the dots in all the rows underneath it. It can be proven that each number between 0 and 720 has exactly one representation as a 5-factoradic.

### Implementation in X11

A computer implementation of the binary clock is quite straightforward. I’ve done it using Xlib (runs under most linux systems). It takes the current time and displays it; it does not update in real time like a real clock:

Here it’s displaying the time 7:26.

The source code:

#include <X11/Xlib.h> #include <time.h> void draw(Display *d,Window w,GC g,int *dots){ // Draw the dots in the clock. Dots are circles with 20px diameters // and 20px in between, arranged in a 60-60-60 lattice. int x = 100, y = 20, i, j; for(i=0; i<5; i++){ for(j=0; j<=i; j++){ // Use XDrawArc if it's off, or XFillArc if it's on. char on = j<dots[i]; if(on) XFillArc(d,w,g,x+40*j,y,20,20,0,360*64); else XDrawArc(d,w,g,x+40*j,y,20,20,0,360*64); } // Next row x -= 20; y += 35; } } int main(){ // Set the time to display time_t current = time(NULL); struct tm * local = localtime(¤t); // Convert time to binary clock format int binarytime = (local->tm_hour%12)*60 + local->tm_min; int dots[5]; dots[0] = binarytime / 360; dots[1] = (binarytime % 360) / 120; dots[2] = (binarytime % 120) / 30; dots[3] = (binarytime % 30) / 6; dots[4] = binarytime % 6; // Create and initialize window Display *display = XOpenDisplay(NULL); int screen = DefaultScreen(display); Window window = XCreateSimpleWindow( display,DefaultRootWindow(display),0,0,220,200, 0,BlackPixel(display,screen),WhitePixel(display,screen)); XMapWindow(display,window); // We don't need to accept any real events but we still need to handle // the expose event so we know if it's showing. XSelectInput(display,window,ExposureMask); XEvent event; GC gc = DefaultGC(display,screen); // Drawing loop while(1){ XNextEvent(display,&event); if(event.type == Expose){ draw(display,window,gc,dots); } } return 0; }

This is my first time using Xlib, and I think this would make a good programming exercise for learning any new GUI framework.

### Conclusion

Although the idea is nice, I don’t think it would be very practical to use a clock like this. The problem that it was designed for, encoding time using less than 28 LED’s, did not really exist. There is no reason we would want to save a few LED’s: indeed using fifteen lights it saves thirteen when compared with the conventional clock. But a base two approach uses five less LED’s, rendering this idea worthless.

The idea of this digital clock is not my own; the idea is originally from the paper *A New Idea for a Binary Clock* by Jorg Pretz. This paper also covers the more mathematical details of the scheme.

A digital clock is the inspiration for http://www.timeassociation.net/ which allows you to to share associations with the numbers on the clock.

LikeLike

They do make binary-encoded decimal clocks, although not so much to save energy as for the sake of geekery. My iPad has one as an app.

One way of doing it is to represent the hour with four dots (so technically, it could go up to 15, but it doesn’t), and the minute with six (allowing for 63). Even with another dot for AM/PM (or for 24-hour time), it’s just eleven LEDs total, more than your ten-dot version and less than your factorial version. (Though not less if you condensed the factorial version to binary for each digit. That would be eleven LEDs instead of fifteen, and even harder to decipher! I like your factorial clock just the way it is.)

Additional possibility, if we want elegance: Develop a new binary-based system of time measurement. Define a new unit of time, the tock, such that there are exactly 131,072 (or 2^17) tocks in a day. (One tock is therefore exactly 675/1024 of a standard second, or about .659 seconds). Now you need just seventeen LEDs to express the current time to the nearest tock, which is a fair bit more accurate than a real-life digital clock using thirty-six LEDs to express the time in seconds.

(For convenience, we might say there are 64 tocks in a “binary minute”. Thus, when checking the time you can ignore the last six LEDs, the same way we usually ignore the seconds on a clock. Cheaper models of binary clock thus need only eleven LEDs, and are still more accurate than real life ones.)

LikeLike