DevHeads.net

System clock change notification

We've long had various bugs filed for our software clocks not properly syncing
when the Linux system clock changes, and we've always wanted some way to be
notified when changes did occur instead of having to always poll for them.

Thanks to a blog on Planet Gnome [1] I've found out that apparently the kernel
recently aquired a new api for notifiying userspace when the system clock has
changed [2] and which Gnome is now implementing support for [3].

Not being too clued up on how we would hook this all up (Solid I guess?) I
just thought I'd bring it to attention and see if anyone knows anymore or
wants to take it forward.

Cheers!

John.

[1] <a href="http://blog.verbum.org/2011/08/22/why-i-joined-gnome-fixing-the-clocks/" title="http://blog.verbum.org/2011/08/22/why-i-joined-gnome-fixing-the-clocks/">http://blog.verbum.org/2011/08/22/why-i-joined-gnome-fixing-the-clocks/</a>
[2] <a href="http://lwn.net/Articles/432395/" title="http://lwn.net/Articles/432395/">http://lwn.net/Articles/432395/</a>
[3] <a href="https://bugzilla.gnome.org/show_bug.cgi?id=655129" title="https://bugzilla.gnome.org/show_bug.cgi?id=655129">https://bugzilla.gnome.org/show_bug.cgi?id=655129</a>

Comments

Re: System clock change notification

By Aaron J. Seigo at 08/26/2011 - 08:40

On Tuesday, August 23, 2011 23:06:55 John Layt wrote:
solid seems the wrong place to me as that is about hardware awareness
(networking, powermanagement, hotplug; those types of things)

what i'd suggest is coding it up in the time dataengine[1] to show it works;
that will cover all the usages of date and time in the various plasma shells.

other possible locations that i can think of include:

* the various KDE or Qt date and time classes, but none of those are QObjects
(a good thing in this case), so no way to signal the application from them

* KGlobalSettings already has a bunch of signals for things like font, icon,
cursor, etc. changes; unfortunately that's in kdeui right now due to all those
UI bits so wouldn't be available to CLI-only apps

* QTimer; it's already a QObject and it would be nice to have support in there
for such cases (as an option; not all timers want to be accurate to the actual
time on the clock, but just time elapsed). that would also solve the Plasma
situation as the time engine uses QTimers to keep itself updated

someone else may well have an even better idea than the above of course :)

[1] kde-workspace/plasma/generic/dataengines/time/

Re: System clock change notification

By Richard Moore at 08/26/2011 - 15:49

On Fri, Aug 26, 2011 at 1:40 PM, Aaron J. Seigo < ... at kde dot org> wrote:
I don't think it should be in QTimer since there's no global instance
or similar. In addition QTimer is much more about elapsed time. Given
John is fixing the time handling in Qt itself too a long term solution
would be a new signal in QCoreApplication.

Cheers

Rich.