Bug 346060 - KAlarm calculates deferred alarm time wrongly
Summary: KAlarm calculates deferred alarm time wrongly
Status: CLOSED FIXED
Alias: None
Product: kalarm
Classification: Applications
Component: general (show other bugs)
Version: 2.10.12-ak
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Jarvie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-11 07:35 UTC by Branimir Amidzic
Modified: 2020-08-17 23:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 15.12.2


Attachments
Calendar file (9.00 KB, text/calendar)
2016-01-31 12:51 UTC, Branimir Amidzic
Details
KAlarm settings (1.39 KB, text/plain)
2016-01-31 12:52 UTC, Branimir Amidzic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Branimir Amidzic 2015-04-11 07:35:29 UTC
When alarm window pops up, I have an option to defer the alarm to specific time, or for a specified time interval. However, the time it calculates for the next reminder is completely wrong.
For example, if I set "Defer to date/time:" at April 11, 2015 - 19:00, the spinner below ("Defer for time interval") correctly calculates the time interval. The correct time is also displayed when I press "OK". But when I press OK again in the main alarm window the time displayed in KAlarm's list of alarms is completely wrong. It is set to April 12, 5:00...
It appears to somehow always adds 10 hours to the time I set.

This happens every time and I've been noticing this bug for months... It is present in this version and probably in earlier versions.

My system time zone is correctly set to Europe/Sarajevo (the HW clock is UTC). In KDE I have two time zones (Europe/Sarajevo and America/Phoenix). I suspected that two time zones are confusing KAlarm, but the time difference between these two locations is 9 hours...

Reproducible: Always

Steps to Reproduce:
1. Set repeating alarm (mine recurrence interval is 75 days)
2. When alarm window pops up defer it for specific time interval or to a specified date and time.
3. Check if the same time is displayed in the main KAlarm window (alarm list).

Actual Results:  
KAlarm doesn't calculate the time for a reminder well.

Expected Results:  
The correct time.
Comment 1 David Jarvie 2016-01-30 14:43:36 UTC
I'm sorry this bug has been overlooked. If possible, can you provide more information on this:

- You say that in KDE you have two time zones. How are these set? (In System Settings, you can only set one time zone, and that sets it for the system.)

- What time zone is set in KAlarm (in the KAlarm menu, go to Settings -> Configure KAlarm -> Time & Date).

- What do you mean by pressing OK in the main alarm window? Did you bring up the alarm edit dialog after deferring the alarm, edit it and click OK?

- Can you please attach a copy of KAlarm's calendar (usually in ~/.kde/share/apps/kalarm/calendar.ics), after deferring the alarm. Please say what time is then shown for the alarm in KAlarm's main window.
Comment 2 Branimir Amidzic 2016-01-31 12:45:48 UTC
Hi, David! Thanks for your interest in this bug.

I've just tested it again and the bug is still there. I have the same KAlarm version as reported previously.
I tied to test it with one-time alarm. I set one display alarm to trigger in several minutes. It did and I successfully deferred it for several more minutes. Time calculation was correct. Then I tried to reproduce the bug with repeating alarm with repeating interval in days.
These are the steps I took;
1. File, New, New Display Alarm (Ctrl+D)
2. Type some display text
3. "At date/time" set to today and checked "Any time"
4. On Recurrence tab I set Daily and Recur every 15 days 
5. After clinking OK, alarm immediately pops.
6. I chose Defer and defer it for 15 hours and 17 minutes, so that it time boxes above it displays that the alarm should trigger tomorrow at 3 a.m.
7. When I press OK the main KAlarm window shows that the alarm will trigger tomorrow at 1 p.m. - IT ADDED 10 HOURS.

Furthermore (I just discovered this). After restarting KAlarm and opening main window, this alarm (previously set for 1 p.m.) was now set to 8 a.m. - it returned back 5 hours! I'm really puzzled. :)
After repeated restart it stays at 8 a.m.

My suggestion is to check calculation of deferred time for DATE-ONLY alarms. In my KAlarm settings for "start of day for date-only alarms" I set 5:00. I guess that that KAlarm added 5 hours to 3 a.m. that I wanted. Main window also added the same amount, but it only was reflected to display of alarms. After restart in effect was only first 5 hours added.

After changing "start of day for date-only alarms" to 06:00, main KAlarm window displayed 3 p.m. and after restarting it got back to 9 a.m. - 6 hours added to 3 a.m. that I wanted.

Please try taking the same steps I took. I'm pretty sure you'll will reproduce this bug, as I tried everything: deleting data and similar.

Regarding your questions:
- I haven't expresses myself correctly. The system is set to CET (GMT+1). Clock applet has three time zones set, but I guess it's only relevant to the clock applet.
- Time zone in KAlarm is same as system time zone (Europe/Sarajevo)
- No, I didn't edit the alarm. I just deferred it, and check if it was set correctly.
- I will add the attachment so you can examine the calendar and KAlarm settings.
Comment 3 Branimir Amidzic 2016-01-31 12:51:59 UTC
Created attachment 96940 [details]
Calendar file
Comment 4 Branimir Amidzic 2016-01-31 12:52:22 UTC
Created attachment 96941 [details]
KAlarm settings
Comment 5 David Jarvie 2016-02-01 12:41:38 UTC
Thanks for your detailed information. It turns out that the bug only occurs when the start-of-day setting is not midnight.

Now fixed in 4.14 branch (commit a791b69599c3571ff2f4b1cc9033d8fb30f1bc33) - although bear in mind that there are unlikely to be any further official KDE 4.14 releases.
Also fixed in 15.12 branch (commit fd5960c66c650ef42207e83b44e80e6e243474dd), for release 15.12.2.