Skip to main content

Overview

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.

Modes

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

Usage

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

geometry

mandatory argument of the form axb, where a and b are integer numbers. It provides the size of the grid of bits.

offset

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.

borderwidth

is the width of each bit inside its frame, in number of pixels.

bgcolor

is the color of the frame, in ‘#rrggbb’ format.

persistent

is a flag that, if present, forces the clock to always stay on top of other windows.

Examples

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

Observations

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.

Collaboration

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

Download files

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

Source Distribution

binary_clock-0.0.2.tar.gz (64.6 kB view details)

Uploaded Source

File details

Details for the file binary_clock-0.0.2.tar.gz.

File metadata

  • Download URL: binary_clock-0.0.2.tar.gz
  • Upload date:
  • Size: 64.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for binary_clock-0.0.2.tar.gz
Algorithm Hash digest
SHA256 95158b9672423b5c19111db3452b2baadc7aa8ff669ba10b499b0269d97d6c84
MD5 d6716f04daffa8dc9446166bfff63cd2
BLAKE2b-256 379836df3e80bbf9ad012d84ec7806750de75c808bb71d188bbed2950c0ad71b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page