Skip to main content

Truly Binary Clock

Project description


There are many binary clocks and watches advertised on the Internet, it is even possible to actually buy wrist binary watches, for instance in Ledwatchstop. However, as far as I know they are only binary on the surface, measuring the time of the day conventionally, in hours + minutes. It’s just that those two numbers are somehow represented in binary.

Module binary_clock provides an implementation of what I consider a truly binary clock. The first bit stands for the half of the day, 12 hours. The second, for the a quarter of a day, 6 hours, and so on. Each bit stands for an interval that is the half of the previous.

For instance, 11010000 represents 12 + 6 + 1.5 = 19.5, which means 7:30 PM.

Another way to see it is that 0.11010000 is the fraction of the day passed, in binary. So, 0.11010000 = 13/16 of a day.


Two modes are provided. The simplest option is to use flat colors, each bit is shown with a square of that color. The binary clock then looks like this:

Binary clock with flat bits

Bits should be read left-to-right, top-to-bottom. With this 4x4 format, it is suitable to stand as one icon more on the desktop.

If you want to get fancy, the second mode allows you to choose any two equal-size images, one for on-bit and another for off-bit, getting something like:

Binary clock with images


All the code is in file, launched by command line script The arguments supported are

mandatory argument of the form axb, where a and b are integer numbers. It provides the size of the grid of bits.
string that provides the initial offset from the bottom-right corner of the screen. For instance, ‘-1-43’ is 1 pixel to the left and 43 upwards. Clocks are draggable, you can move them once created.
side and color
For the flat mode. In the latter case, side is the number of pixels per side, and color a string in format ‘#rrggbb’ in hexadecimal. For instance, yellow is ‘#00ffff’.
imageon and imageoff
Strings for filenames, for the image mode. If provided, options side and color are ignored.
is the width of each bit inside its frame, in number of pixels.
is the color of the frame, in ‘#rrggbb’ format.
is a flag that, if present, forces the clock to always stay on top of other windows.


Flat mode:

binclock --color=#30a0ff --side=10 --borderwidth=2 --bgcolor=#808080 --geometry=4x4 --persistent

Image mode:

binclock --imageon=light_green_button.jpg --imageoff=dark_green_button.jpg  --borderwidth=3 --bgcolor=#808080 --geometry=1x12


The blinking frequence of each bit is twice that of the previous bit. With 16 bits, the last one stands for 2^-16 days, more or less 1.318 seconds. So, 16 bits is the closest you can get to the typical hours + minutes + seconds watch. If the value provided for geometry contains too many bits:

  • The consumption of CPU time will be noticeable
  • The computer/screen might not be fast enough to refresh bits with the speed that would be required.

In tests I performed, that limit of reasonable behaviour seems to be around 22 bits, but there seems to be little point in using that many.


You may wish to improve or add features, in that case you are more than welcome, feel free to contact me at

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for binary_clock, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size binary_clock-0.0.2.tar.gz (64.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page