Bug 392476

Summary: Digital Clock is persistently late by up to one second
Product: [Plasma] plasmashell Reporter: Eugene Jolas <kde.org>
Component: Digital Clock widgetAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: kde, microcaicai, nate, s.horvath, yule2000
Priority: NOR    
Version: 6.0.2   
Target Milestone: 1.0   
Platform: Kubuntu   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=436796
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Eugene Jolas 2018-03-29 05:01:12 UTC
Add a Digital Clock plasmoid to the panel and enable seconds display. Run "xclock -digital -update 1" and compare the two clocks. xclock will advance the seconds precisely when the system clock ticks, but odds on the Digital Clock will be delayed by up to a second. The exact offset fluctuates, and is different each time seconds display is disabled and then re-enabled. This also affects the time at which the Digital Clock advances minutes.

xclock makes sure it updates on time in an elegant way: subtract the current time from the time the next update is due, and wait that number of microseconds. See xclock/Clock.c:waittime() for details.

Digital Clock doesn't seem to do this. It seems to wait to be painted, and then prints the current time accurate to the second. That will always create this bias.

Qt::formatTime() does seem to support milliseconds using the .zzz expression, but scheduling updates may be more challenging. If the API allows it, Digital Clock should be modified to request updates at the correct time, not just let them happen.
Comment 1 Kai Uwe Broulik 2018-03-29 07:18:52 UTC
> subtract the current time from the time the next update is due

Plasma data engine polling works similarly, trying to batch upcoming updates and schedule them e.g. on the full minute or second but it allows some deviation in order to reduce wakeups when there's multiple dataengines polling.
Comment 2 Nate Graham 2020-10-18 14:55:40 UTC
Can confirm.
Comment 3 Timothy B 2022-08-08 13:58:12 UTC
I can reliably reproduce this under Plasma 5.25.4 and 5.24.6 after waking up the monitor from sleep. In that case, the clock in either Plasma or Latte Dock ends up being late by about a second, and the second-skipping behavior at zero seconds as described in bug #436796 occurs as a result. The only workaround is to restart plasmashell/Latte multiple times until the clock is no longer running a full second late. It's frustrating that this is an incredibly difficult bug to pinpoint, which explains why it hasn't been fixed for so long.

SYSTEM INFORMATION
Operating System: Manjaro Linux
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.16-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 1600 Six-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 570 Series
Comment 4 microcai 2023-10-22 13:58:33 UTC
any updates? bug still there on plasma 5.27
Comment 5 Nate Graham 2023-10-23 21:03:55 UTC
*** Bug 475962 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2023-11-16 20:54:38 UTC
*** Bug 477082 has been marked as a duplicate of this bug. ***
Comment 7 microcai 2024-03-15 15:31:29 UTC
still exist on plasma 6.0.2