[PATCH 0/9] panel: clock: fixes and new binary clock mode

Felipe Contreras felipe.contreras at gmail.com
Fri Jun 14 02:40:35 CEST 2019


A true binary clock shouldn't based on hours (mod 12), but on bits (mod

Take for example the following clock:


In order to make sense of it we would have to find out if it's
binary-coded decimal (BCD), or sexagesimal. And then if it's packed or
not, and where the divisions are.

But we could say this number is a binary... A true binary.

To see if this is the highest part (past 12) or the lowest part (before
12), we just look at the most significant digit '1'. So it's past noon.

Then of those later 12 hours are we in earlier or later? We look at the
second digit '0', so it's between 12-18; We still have a quarter of the
day left. We continue like that until the last digit, which is similar
to a second, but not quite.

This is a 16-bit binary clock; that is: a clock whose value is a real
binary, on which you can do binary operations. By dividing the day into
2 ^ 16 equal parts it's easy to represent the most and least significant
  parts of a day.

  000: day started
  100: past noon
  010: early morning (6am)
  110: afternoon (6pm)
  001: 3am
  011: 9am
  101: 3pm
  111: 9pm

We can't call this the true true binary clock, but it pretty much is.

In order to represent minutes (not seconds) we need the first 10 most
significant bits.

I also created a bug report:

Felipe Contreras (9):
  clock: binary: add missing unref
  clock: binary: fix widget style
  clock: binary: simplify
  clock: binary: trivial refactoring
  clock: binary: no need to calculate offset
  clock: binary: cleanup grid draw
  clock: binary: refactor into algorithm funcs
  clock: binary: add new mode option
  clock: binary: add sixteen bits mode

 plugins/clock/clock-binary.c     | 302 ++++++++++++++-----------------
 plugins/clock/clock-dialog.glade |  63 ++++++-
 plugins/clock/clock.c            |   4 +-
 3 files changed, 191 insertions(+), 178 deletions(-)


More information about the Xfce4-dev mailing list