If you use qt, you can use QTimer, which by default creates a repeating timer.
In the documentation (see below) there is an example (Analog Clock).
QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); timer->start(1000);
source share