Recompiling Ubuntu clock to display in hex

Recently I was thinking what would be a good idea to enforce learning fast
hex<->decimal calculation in my head. Obviously, I thought about reading current time in hex, but there is no checkbox for that in the vanilla ubuntu indicator-datetime service (silly Canonical, not including hex time option).

Why not compile a version, that supports that, though? Here’s my modified version:

Screenshot from 2018-09-03 09-05-14
Hex hour to decimal: 09:05:14

And here’s how I did this:

I Download sources

My Ubuntu is 16.04 LTS, which is important because there are different sources for each major version. Anyway, I found sources here:

>> https://launchpad.net/ubuntu/+source/indicator-datetime

This link in particular provides sources for Ubuntu 15 / 16:

>> https://launchpad.net/ubuntu/+source/indicator-datetime/15.10+16.04.20160406-0ubuntu1

II Download dependencies

<in unzipped source folder>
>> mkdir build && cd build
>> cmake ..

My computer lacked certain packages, as I recognized when reading cmake’s log.
What I did in this case was googling “ubuntu package <package name>”, which moved me to the packages.ubuntu, i.e for libecall I found this package:

>> https://packages.ubuntu.com/xenial/libecal1.2-dev

so I typed

>> sudo apt-get install libecall1.2-dev in the terminal.

I did this for every missing package untill cmake returned successfully.

III Modify sources

open the formatter.cpp at void update_header() and modify the function so it would look like:

Screenshot from 2018-09-03 10-12-37

IV Compile

<in build folder> 
>> make

V Stop the current indicator-datetime.service, run our own for testing

I recommend you copy the existing indicator-datetime-service, so you could recover if you change your mind.

Screenshot from 2018-09-03 10-35-59

VI Reboot so the deamon would run our service

PS: I am not affiliated with Ubuntu nor Canonical, it’s just tinkering with their GNU sources.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s