pvr.mythtv: Time zone issue
#1
I'm using pvr.mythtv 1.12.28 on OpenElec 5.0.8.

I see that the pvr.mythtv plugin is presumably using a wrong timezone for my scheduled recording and previous recordings.

- I'm on timezone GMT+1 (currently daylight saving GMT +2) / CEST
- The time on OpenElec is shown correct in top right corner
- Next recording and scheduled recordings is minus one hour. So when next recording is actually 20:00 CEST it is shown as 19:00
- Using mythtv front-end, the correct time is shown

If you need futher information, please describe what information you need.
Reply
#2
is the mythtv server running on the same machine? if not, thats where it needs to be changed. if it is the same machine, change the timezone to something incorrect then back to correct, then restart. you can also check to make sure its set correct in /etc/php5/apache2/php.ini.
Reply
#3
I guess your timezone is not set correctly in OpenElec. Fixing it you will see right local time. Also you should check mythbackend timezone according with your timezone, maybe the issue could be here instead.
Else all time data transfered from/to backend/addon use UTC zone, so any issue about could be in server side or front side.
Reply
#4
As described, the time is shown correctly in Kodi in top right corner. Using SSH, the date command show the correct timezone in openelec as well. Using the date command on the external MythTV linux server show the correct timezone too.

Is there any files I can collect that will convince you Smile
Reply
#5
No need to convince me Wink. i use timezone CEST with daylight saving (+2) like you and many users use different timezone around the world without issue. Probably your database has not been setup correctly: Have you initalized timezone data ? You could have a look on MythTV installation guide, it is explained how to configure this point.

You can extract record schedules as the addon do with your browser using url:

http://backendIP:6544/Dvr/GetRecordSched...artIndex=0

Code:
...
<RecRule>
<Id>536</Id>
<ParentId>0</ParentId>
...
</Description>
<Season>0</Season>
<Episode>0</Episode>
<Category>magazine</Category>
<StartTime>2015-08-23T09:30:00Z</StartTime>
<EndTime>2015-08-23T10:05:00Z</EndTime>
<SeriesId>85678185</SeriesId>
<ProgramId/>
<Inetref/>
<ChanId>1008</ChanId>
...
<NextRecording>2015-08-23T09:30:00Z</NextRecording>
</RecRule>
...

You could check values of StartTime and Endtime which use UTC time.
Reply
#6
Ok, I did some more tests

- The time zone and time is shown correctly on my mythtv linux box
- The time zone and time is shown correctly in mythtv web
- The time zone and time is show correctly in Kodi on OpenElect 5.0.8
- The time is shown correctly in UTC using GetRecordScheduleList
- The output from mythv plugin for next recordings is one hour off.

Here comes the part that puzzles me. As explained the time is shown correctly on both Kodi (right hand top corner) and OpenElec (using SSH and date command). But if I go and change the time zone to something different in Kodi, and then back to my time, the myttv plugin suddenly show the correct time.

If I then reboot OpenElec the issue is back. The time is correct at any time in Kodi, and is shown correctly after reboot (and NTP sync). This can be replicated at every reboot of OpenElec. If I just restart Kodi (systemctl restart kodi) I can't replicate it.

What could be causing this?
Reply
#7
I just add information to my pevious post.

I'm running OpenElec off a Raspberry Pi 2. So when it reboots, the clock is not persistent. When it boots up, the time zone is CET until NTP have synced the time and date. Then it changes to CEST.

Could it be that the mythtv plugin starts before the time is correctly synced and then show information with the time zone information at boot time?

Then when NTP catches up, the information from mythtv plugin is not updated automatically, but only when time zone is manually changed as described in my previous post.
Reply
#8
I seem to remember something in a manual saying that localtime_r(), which the pvr.mythtv client uses, isn't guaranteed to always re-apply the local timezone, whereas localtime() does.
The manual suggested that tzset() should always be called before localtime_r() to ensure the timezone is applied correctly. I haven't seen the mythtv client code do this, so maybe this might explain something.

It's a bit of a long-shot but coupled with your installation defaulting to CET rather than CEST and the PI2 not having a hardware clock this might point in the right direction.
If the mythtv client is storing something when it thinks the clock is 0 (1/1/1970 - winter time) and comparing it to now (24/8/2015 - summer time), this could explain the loss of an hour.

@LarssonDK
  1. Can you post what the results are if you run 'date' on your mythbackend box.
  2. Can you post what Settings->Appearance->International says for 'Timezone country' and 'Timezone'.
  3. Can you post what OpenELEC Settings->Network->Timeserver #1 / #2 / #3 are (and explain if they are machines on your local network)
  4. If you go to the 'Timers' window and look at your upcoming recordings, are the timestamps there also one hour out? - I expect they will be.
  5. Once you see the symptoms, can you force the timers list to update by adding or deleting a timer (using mythfrontend, mythweb or kodi). If this causes the times to become correct, that would certainly be informative.
  6. Could you post a debug log (http://kodi.wiki/view/Log_file/Easy).

I've got OE 5.0.8 running on a Pi (and a Pi2 if necessary), so could try and reproduce your issue if I know what your settings are.

I don't see the problem here, but maybe it has to do with the performance of your chosen ntp server and how quick it syncs up the Pi2's clock. My mythbackend is also my local ntp server, so maybe it responds faster than using an internet 'pool' server would.
Reply
#9
@LarssonDK, @metaron, sure the timezone of the environment SHOULD be set correctly before starting Kodi else .... Wink

EDIT: to be a little more clear the addon never does any time convertion related to time values of upcoming recordings using localtime_r. But as i said above the environment must to be correctly configured before starting Kodi because timer data are gathered from mythtv-backend on pvr startup: At this point Kodi could make convertion to display time values at local timezone.
Reply
#10
@LarssonDK have you fixed your issue finally ? IMO @metaron has given you the good way to fix it regarding your NTP setup.
Reply
#11
(2015-08-29, 15:28)janbar Wrote: @LarssonDK have you fixed your issue finally ? IMO @metaron has given you the good way to fix it regarding your NTP setup.

No, the issue is not resolved. But as mentioned, it is probably because Kodi starts before a reasonable time is set in OpenElec. I am using an internal NTP server, and will collect the information as requested.

A simple fix could be using the ntpdate command in autostart.sh (which should run before Kodi starts):
http://wiki.openelec.tv/index.php?title=Autostart.sh
Reply
#12
It seem that ntpdate is not a part of OpenElec 5.0.8

I then created a autostart.sh with the following content to slow the start of Kodi down.
Code:
#!/bin/sh
sleep 30

Now Kodi starts up with the correct time and the PVR data is correct at boot.
Reply
#13
LarssonDK - if you are using your own ntp server, have you configured it to allow 'burst' mode?
If not, this might significantly reduce the time the RPi takes to get its clock in sync.
Reply
#14
(2015-08-31, 21:38)metaron Wrote: LarssonDK - if you are using your own ntp server, have you configured it to allow 'burst' mode?
If not, this might significantly reduce the time the RPi takes to get its clock in sync.

I'm not sure. I thought that burst was a NTP client feature. I can't find any references allowing burst on the NTP server.

The problem is solved for me, and should be corrected in OpenElec so it won't start Kodi before time sync if NTP is set (or at least wait a reasonable time).
Reply

Logout Mark Read Team Forum Stats Members Help
pvr.mythtv: Time zone issue0