v17 EPG has been off by one hour since daylight savings time ended
#1
My epg has been off by an hour since we switched back to standard time.

I've tried uninstalling the nextPVR client and clearing the guide databases, rebooting and then installing nextPVR. The epg time is correct until I reboot Kodi and then it goes back to being one hour off.

Here's a link to my log: Kodi log (epg issue) 11/12/17 - Pastebin.com


By the way, I am running Kodi on 2 Raspberry Pi systems and only one of them has the epg time problem.

Their configurations are the same except one has more addons than the other and of course they are connected to different TVs. By the way, the OS clock time is correct on both systems.

The one with the additional addons is the problem child.

I'm in the U.S. eastern U.S. time zone (New York) and my temporary work around involves switching the tz to Detroit, which fixes the problem and then switching it back to the eastern tz. Please note that once I reboot, the problem comes back.

I have never had this problem before. Any suggestions for resolving this issue will be greatly appreciated.



Sent from my Galaxy Tab 2
Reply
#2
This happened to my EPG on the daylight saving change as well with MythTV as the backend. Clearing the Kodi EPG database and rebuilding it partially fixed it, but still has issues.

Whatever is calculating the time differences for a given day appears to be assuming a constant shift from UTC to the local time. This is incorrect behavior.

Right after daylight saving time, all times were presented in summer time, so all upcoming recordings and the EPG were listed 1 hour ahead of their actual time. Recordings from before the daylight saving time shift were listed at the correct time. After clearing and repopulating the EPG database, all times were presented in standard time, including previous recordings. Recordings that happened during the summer were listed 1 hour earlier than their actual time.

MythTV and the mythweb interface present times correctly across the summer time/standard time change. Since jmooremcc is also seeing it with nextPVR, it appears to be a Kodi issue with the time calculation.
Reply
#3
I don't think any kodi/pvr developer uses the EPG database.
Reply
#4
(2017-11-16, 18:59)FernetMenta Wrote: I don't think any kodi/pvr developer uses the EPG database.

You mean Epg11.db? Yes, that is empty. I meant the Clear EPG option in the Kodi menu for resetting it. I think I found the bug. It's in xbmc/XBDateTime.cpp. That appears to assume a constant TimeZone Bias when calling CDateTime::SetFromUTCDateTime, and PVR is using the CDateTime objects and calling SetFromUTCDateTime in CPVRRecording::RecordingTimeAsLocalTime. 

CDateTime::GetTimezoneBias uses a static variable to store the timezone bias which is populated based on the current time. Since the bias shifts twice per year with daylight saving time, this will give incorrect times for dates during summer time in winter and vice versa.

Introduced by: https://github.com/xbmc/xbmc/commit/6801...db7f24af8f
Nevermind, the issue was still there prior to that since GetTimezoneInformation was still shifting without regard for the date.
Reply
#5
Problem Solved:

I compared my 2 RPi systems and found that the problem child had an LE setting the good system didn't have: a timeserver setting. I've removed the timeserver setting and have rebooted the problem child 6 times and each time, the EPG time was correct.

Background:

RPi systems do not have a clock so when the internet is down, an RPi shows the time it was the LE software was compiled. My solution to this problem was to turn my back end NextPVR server, a Windows 10 desktop PC, into a time server for the RPi since it has a clock. The solution appeared to work well until Daylight Savings Time ended. I don't know if the problem would exist if I had specified an external time server. What I do know is that specifying the windows PC as a time server is problematic.


Sent from my Galaxy Tab 2
Reply
#6
(2017-11-17, 02:46)jmooremcc Wrote: I don't know if the problem would exist if I had specified an external time server. What I do know is that specifying the windows PC as a time server is problematic.
 I've just experienced this same problem over the weekend since the UK clocks went forward 1 hour for BST.

I am running Kodi v17.6 on LibreELEC v 8.2.3 with Tvheadend v4.2.5, with the pvr.hts client on the same machine.

I have not touched the LibreELEC time server settings, so it's using the standard internet time server that ships in the LE settings by default.

On Saturday (when we were on GMT), I was looking ahead in the TVGuide as I wanted to schedule a program that started at 07:30PM on Monday 26th March. However, the TVGuide was showing the program as starting at 06:30PM. I then realised that this was probably because the clocks were changing Saturday night/Sunday morning, so I didn't worry.

However, on Sunday morning, following the Daylight saving changes, I went to look in the TVGuide again and everything was still out by an hour including the programs currently playing. The system time, which is also displayed top-right of the TVGuide had been changed to reflect the DST, so this was correct. However, the TVGuide data was all out by an hour e.g. a show which started at 11AM was actually showing as having started at 10AM, so the timeline which goes vertically down the screen was therefore over whichever program starts in 1hr time.

To correct this I went into Kodi Settings -> PVR & Live TV -> General -> Clear data. The database was cleared and refreshed from the Tvheadend backend (as mentioned, this is on the same machine). Following this, all the times were then correct. It would be nice if we didn't have to do this whenever the clocks change.
Reply
#7
(2018-03-26, 12:10)jahutchi Wrote:
(2017-11-17, 02:46)jmooremcc Wrote: I don't know if the problem would exist if I had specified an external time server. What I do know is that specifying the windows PC as a time server is problematic.
 I've just experienced this same problem over the weekend since the UK clocks went forward 1 hour for BST.

I am running Kodi v17.6 on LibreELEC v 8.2.3 with Tvheadend v4.2.5, with the pvr.hts client on the same machine.

I have not touched the LibreELEC time server settings, so it's using the standard internet time server that ships in the LE settings by default.

On Saturday (when we were on GMT), I was looking ahead in the TVGuide as I wanted to schedule a program that started at 07:30PM on Monday 26th March. However, the TVGuide was showing the program as starting at 06:30PM. I then realised that this was probably because the clocks were changing Saturday night/Sunday morning, so I didn't worry.

However, on Sunday morning, following the Daylight saving changes, I went to look in the TVGuide again and everything was still out by an hour including the programs currently playing. The system time, which is also displayed top-right of the TVGuide had been changed to reflect the DST, so this was correct. However, the TVGuide data was all out by an hour e.g. a show which started at 11AM was actually showing as having started at 10AM, so the timeline which goes vertically down the screen was therefore over whichever program starts in 1hr time.

To correct this I went into Kodi Settings -> PVR & Live TV -> General -> Clear data. The database was cleared and refreshed from the Tvheadend backend (as mentioned, this is on the same machine). Following this, all the times were then correct. It would be nice if we didn't have to do this whenever the clocks change.
You're correct about needing to either reboot Kodi or force a refresh of the EPG data. I set up my system to reboot every morning at 4:30 am using cron so my EPG was automatically corrected.
Reply
#8
(2018-03-26, 14:21)jmooremcc Wrote:
(2018-03-26, 12:10)jahutchi Wrote:
(2017-11-17, 02:46)jmooremcc Wrote: I don't know if the problem would exist if I had specified an external time server. What I do know is that specifying the windows PC as a time server is problematic.
 I've just experienced this same problem over the weekend since the UK clocks went forward 1 hour for BST.

I am running Kodi v17.6 on LibreELEC v 8.2.3 with Tvheadend v4.2.5, with the pvr.hts client on the same machine.

I have not touched the LibreELEC time server settings, so it's using the standard internet time server that ships in the LE settings by default.

On Saturday (when we were on GMT), I was looking ahead in the TVGuide as I wanted to schedule a program that started at 07:30PM on Monday 26th March. However, the TVGuide was showing the program as starting at 06:30PM. I then realised that this was probably because the clocks were changing Saturday night/Sunday morning, so I didn't worry.

However, on Sunday morning, following the Daylight saving changes, I went to look in the TVGuide again and everything was still out by an hour including the programs currently playing. The system time, which is also displayed top-right of the TVGuide had been changed to reflect the DST, so this was correct. However, the TVGuide data was all out by an hour e.g. a show which started at 11AM was actually showing as having started at 10AM, so the timeline which goes vertically down the screen was therefore over whichever program starts in 1hr time.

To correct this I went into Kodi Settings -> PVR & Live TV -> General -> Clear data. The database was cleared and refreshed from the Tvheadend backend (as mentioned, this is on the same machine). Following this, all the times were then correct. It would be nice if we didn't have to do this whenever the clocks change.
You're correct about needing to either reboot Kodi or force a refresh of the EPG data. I set up my system to reboot every morning at 4:30 am using cron so my EPG was automatically corrected.


This is a known problem, yes, but no need to restart Kodi every day. Doing this to work around the daylight saving time change at the day the switch happened is enough.
Reply
#9
(2018-03-26, 14:34)ksooo Wrote: This is a known problem, yes, ... 
Is this bug scheduled to be fixed in Leia?

If so, will the times in the TV Guide be correct just prior to DST when looking ahead to future days (post DST)? For example, if the clock is due to go forward at 01:00AM on Sunday morning, and on Saturday evening I look in the TV Guide for events scheduled for Sunday/Monday/Tuesday/etc. Will those events show the correct (post DST) time? Or will it just correct the offset after the clocks change?
Reply
#10
(2018-03-26, 15:53)jahutchi Wrote:
(2018-03-26, 14:34)ksooo Wrote: This is a known problem, yes, ... 
Is this bug scheduled to be fixed in Leia?

If so, will the times in the TV Guide be correct just prior to DST when looking ahead to future days (post DST)? For example, if the clock is due to go forward at 01:00AM on Sunday morning, and on Saturday evening I look in the TV Guide for events scheduled for Sunday/Monday/Tuesday/etc. Will those events show the correct (post DST) time? Or will it just correct the offset after the clocks change?

I doubt so, because I don't feel it's necessarily a bug. Kodi is merely displaying the times as reported by the PVR backend. If your backend is adjusting for the time change, and then Kodi adjusts on top of that, then you're even more off. This is best left to the backend to manage.
Reply
#11
Afaik tvheadend supplies the times in epoch, certainly the api does, though cant say for certain whether the same is true of htsp? Since a restart of kodi or just a clean of the epg database corrects it this likely indicates the problem lies in kodi. This thread seems to suggest it affects multiple backends too.
Reply
#12
(2018-03-26, 18:26)jahutchi Wrote: Afaik tvheadend supplies the times in epoch, certainly the api does, though cant say for certain whether the same is true of htsp? Since a restart of kodi or just a clean of the epg database corrects it this likely indicates the problem lies in kodi. This thread seems to suggest it affects multiple backends too.

Internally Kodi uses UTC. The problem is only cosmetically, all time based calculations are done correctly. It's just the various UI elements caching the time strings they display to the user and they do not have a clue when to refresh those strings.

And yes, it's a Kodi bug and no it's not scheduled to get fixed for Leia. Nothing is actually scheduled for Leia. Devs set their own priorities as this is all about work done voluntarily in their free time...

BTW, cleanup of EPG data is not needed to fix this problem - just restart Kodi - done.
Reply
#13
Is there any other way without restarting KODI?
I tried reloadSkin but didn't seem to work...

I'm writing a service add-on that monitors the UTC offset and runs a defined function if the offset changes (eg. DST change)

I'll release the add-on once I find the suitable function (https://kodi.wiki/view/list_of_built-in_functions) to be default.
Maybe just "Reboot"?

Also to note there is a bug in IPTV Simple Client (on Windows only) that means during DST, you need an offset +1 to compensate for the bug.
https://github.com/kodi-pvr/pvr.iptvsimple/issues/158
Reply
#14
(2018-04-03, 02:43)matthuisman Wrote: Is there any other way without restarting KODI?

...

I'll release the add-on once I find the suitable function (https://kodi.wiki/view/list_of_built-in_functions) to be default.
Maybe just "Reboot"?

No, the only workaround is to restart Kodi.

Reboot is not the best choice, althought working, as it restarts the whole machine, including operating system and all apps. You just need to end Kodi, not the whole system.
Reply
#15
Great Smile

I finished the Service Add-on that will monitor for a Time Change and then run a function (default=Reboot)

Info here: 
https://www.matthuisman.nz/2018/04/time-...dd-on.html
Reply

Logout Mark Read Team Forum Stats Members Help
EPG has been off by one hour since daylight savings time ended0