Bug 463278 - "Time from now" alarms are unexpectedly imprecise
Summary: "Time from now" alarms are unexpectedly imprecise
Status: RESOLVED FIXED
Alias: None
Product: kalarm
Classification: Applications
Component: general (show other bugs)
Version: 3.3.6
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: David Jarvie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-20 18:40 UTC by Rickard Westman
Modified: 2022-12-30 18:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 23.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rickard Westman 2022-12-20 18:40:43 UTC
STEPS TO REPRODUCE
1. Open the dialog box for a new display alarm.
2. For the alarm time, select "Time from now" with a period of 1 minute, but don't click OK immediately.
3. Wait until the system time is 5 seconds before a whole minute, then click OK.

OBSERVED RESULT
The display alarm is triggered after 5 seconds, rather than the requested 1 minute.

EXPECTED RESULT
I expected the display alarm to trigger after 1 minute, precise to the second or so.

SOFTWARE/OS VERSIONS
Linux distribution: Kubuntu 22.04.1 LTS
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL COMMENTS
I assume the alarm trigger time is always converted to an absolute time, and that the truncation to whole minutes takes place because absolute times are only kept with minute precision.  Fine for absolute trigger times, but not really adequate for relative times which could reasonably be a small number of minutes.  For minimal changes, perhaps store the time with second precision and use that for triggering, but round to nearest minute when shown/edited as an absolute time in the UI?
Comment 1 David Jarvie 2022-12-20 22:49:26 UTC
KAlarm does not provide sub-minute accuracy. All alarms are scheduled to (approximately) minute boundaries. You need to use an alternative application if you need reminders more accurate than to the nearest (rounded down) minute.
Comment 2 Rickard Westman 2022-12-21 10:13:10 UTC
I understand the technical reason, but when you can set an alarm for 1 minute and it fires after 1 second, it strains belief that any non-developer could see that as expected and intended behavior.  So even if it's intentional from a technical/internal perspective, I'd encourage thinking about it from the user perspective.  What is the user intent of specifying a 1 minute interval?  To get an alarm after 1 minute, or getting an alarm at a random time between 0 and 60 seconds?  Is there any scenario at all where the latter would be useful?
Comment 3 David Jarvie 2022-12-21 11:12:42 UTC
KAlarm was never intended as a high accuracy timer, but rather as an application to help people organise their lives and remember to do things. I can see that if you expect it to act as a stopwatch you will get a surprise, but the fact that if you set a specific time for an alarm (as opposed to time from now) you can only enter a minutes value and not seconds gives a hint as to its accuracy limitations.
Comment 4 Rickard Westman 2022-12-21 12:32:46 UTC
It's not really stopwatch accuracy I expect, but more like kitchen timer accuracy.  An alarm set for 2 minutes should not trigger after 1 minute.  An alarm set for 1 minute should not trigger after 0 seconds.  So it's not really about users being surprised they don't get precision down to the second, but more of an expectation that the minutes they specify in KAlarm are about as long as a minute is in real life.  So a minute implemented as 58 seconds or 62 seconds could be within expectations, but a minute implemented as 0 seconds or 120 seconds would not.  

I don't really buy the argument that a time interval specified in minutes comes with an expectation that the error can also be up to a minute – the relative error matters as well, and a relative error of 100% (as can happen with KAlarm) is just too huge to be reasonably expected.
Comment 5 David Jarvie 2022-12-21 13:11:55 UTC
It would require a significant redesign to trigger alarms at times other than on a minute boundary. Given that this would be very much a minority requirement, the most that I could contemplate doing would be to add a warning when a short time from now interval was selected.
Comment 6 Rickard Westman 2022-12-21 14:04:01 UTC
That sounds like a good idea!  Perhaps rounding to the nearest minute (rather than truncating) would also be a rather simple change, cutting the relative error in half?
Comment 7 David Jarvie 2022-12-30 18:53:16 UTC
A warning will now be shown if a time-from-now value of less than 10 minutes is specified. This will be in KAlarm version 3.5.5 in KDE Gear 23.04. Commit e89af9582261714442766b3390e3d60f81b60157.