The Samsung clock now has a "pre-alarm-notification".
Five minutes before the actual alarm you get a notification on your phone of the upcoming alarm (in the notification area).
Before the pre-alarm-notification time, si(alarmd) will give the "5 minutes earlier" time. But after the pre-alarm-notification, the si(alarmd) will give the correct time (for 5 minutes).
So, the solution of adding 300 seconds will of course work, but only until you reach this 5 minute marker. After the 5 minute marker, you don't need the extra 300 seconds anymore.
I think Samsung did a dirty job of getting the 5 minute pre-alarm-notification and unfortunately I have not found a way to disable this pre-alarm-notification option in the Samsung clock.
So, there's not much we can do about it I guess. And I also guess Samsung will not be changing this very soon...
This makes sense, thank you for digging in. It seems that changing code in our widgets and wallpapers can fix the problem for a Samsung device, but then that widget won't work right on other devices.
Would you consider adding an offset to the settings of the KWGT and KLWP programs that we users can turn on that changes how the program reads the next alarm? So on a Samsung device we could throw the switch and KWGT or KLWP would do the math you figured out for the next alarm time and the regular next alarm code would work?
Also, same thing for how Samsung uses the next alarm function to display when a reminder is due. So if I have a reminder to take out the trash at 6 pm on Tuesday, KWGT always says I have an alarm set. I am guessing Samsung has a flag or code on these alarms saying if they are reminders or the clock?
Thank you so much for looking in to this and helping.
I have solved creating an 'alarm' global variable. It checks if there is a notification from Samsung clock app: if there is, it means that an alarm will fire within 5 minutes so it'll return the original si(alarmd); if there isn't any notification, it returns a KWGT formatted datetime from si(alarmd) + 5 minutes.
So, when I have to use the next alarm in KWGT, I call gv(alarm) instead of si(alarmd).
Seems working :)
You may want to check the package name of your Samsung clock app.