A clock display program for the Raspberry Pi
C++ QMake
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.md
Main.cpp Basic saving of the running configuration Aug 21, 2017
PowerManager.cpp Replace vbetool with xset. Dimming of display according to light level Jul 9, 2014
PowerManager.h
README.md Added command-line option parsing Apr 13, 2014
TimeDisplay.cpp Retirement genralised to Countdown Sep 11, 2017
TimeDisplay.h
rpiclock.png Initial commit Mar 8, 2014
rpiclock.pro
rpiclock.xml Retirement genralised to Countdown Sep 11, 2017

README.md

Installation

You will need to install Qt4 development packages. On the Raspberry Pi, run:

sudo apt-get update
sudo apt-get install qt4-dev-tools

and then, in the rpiclock source directory:

qmake-qt4 rpiclock.pro
make

You need ntpd running and synchronised. Make sure that /etc/ntp.conf allows ntp queries via the local interface:

restrict 127.0.0.1
restrict ::1

Setting up a Raspberry Pi

Assuming the user pi is running rpiclock:

/etc/inittab needs the line

1:2345:respawn:/sbin/getty --noclear 38400 tty

changed to

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

so that pi is automatically logged in on tty1

/etc/rc.local needs the line

su -l pi -c startx

to automatically start X-windows

In pi's home directory you need the file

.config/autostart/rpiclock.desktop

which contains

[Desktop Entry]
Type=Application
Exec=/path/to/rpiclock

to automatically run rpiclock.

Startup on system boot is a bit slow. The kernel will not declare "synchronised" until about 15 minutes after boot so the time will not be displayed during this period. This is a bit pernickety but I have an aversion to displaying the wrong time.

Power management

The tvservice tool is used on the Raspberry Pi. This has worked fine for me on an LCD monitor. The display and the backlight go off.

On other Linuxen+x386, YMMV. I tried dpms and vbetool but there were problems. With xset, the backlight would go off briefly and then come back on. With vbetool, there were occasional freezes of up to 30s before the monitor turned off. Unfortunately there is no standard way of controlling the monitor in Linux so power management may not work for you.

On Debian systems, vbetool needs to run via sudo so to disable the password for just vbetool you need to edit /etc/sudoers:

user_name ALL=(ALL) NOPASSWD: /usr/sbin/vbetool

Configuration file

rpiclock uses a configuration file rpiclock.xml. The comments in the sample file should be enough to get you going. The search path for this is ./:~/rpiclock:~/.rpiclock:/usr/local/etc:/etc All other paths are explicit.

Known bugs/quirks

The power on/power off logic assumes on < off.

Website

There's a bit more information and screenshots at ninepointtwoghz.org