Mythweb using wrong time/timezone [Solved]

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
kmpatel
Newcomer
Posts: 13
Joined: Fri Nov 28, 2014 4:26 pm
United States of America

Mythweb using wrong time/timezone [Solved]

Post by kmpatel » Wed Jul 06, 2016 6:38 pm

I'm having trouble with getting mythweb to show the correct time/timezone. I'm in EDT but in mythweb (mythtv 0.28 on Ubuntu 16.04), the displayed time is 3hr off. I'm presuming that mythweb thinks the correct timezone is PDT. I read in some old posts that mythweb (pre 0.28) automatically grabs the system timezone but that has not happened over the last few days. I assume that is still the case, but that is not apparently happening in my system. The hardware time (as shown in BIOS) is the correct UTC time and the linux system clock has been set and confirmed ('data +%Z' + 'hwclock -r') to be the correct timezone and shows the current time.

The system is a fresh install of Ubuntu 16.04 with a follow-up installation of mythtv 0.28 + mythweb (upgrading from mythtv 0.27). But I had not noticed until a few days later that mythweb was showing the wrong time by 3 hours. I checked the linux system clock, and sure enough, it showed PDT instead of the proper EDT, so I corrected it. But since then, mythweb has not updated it's knowledge of time. In mythweb, the program guide and "Recorded Programs" stilll shows all everything in with 3 hr offset (seemingly PDT). On the other hand, the various frontends (remote and local to backend) all show the corrent EDT times in both the program guide and recording times. And the backend is starting/ending all recordings at the correct time.

I've now waited 2+ days for mythweb to correct itself, since I corrected the backend system timezone for mythweb. I've restarted the server multiple times, dpkg-reconfigure mythweb several times, and have purged and reinstalled mythweb several times...over the last couple of days....all to no avail.

Can some please help me figure out what is going on with mythweb? I might be willing to live with the problem, but mythweb is also not letting me schedule any recordings (it complains about 'Incorrect datetime value') and I'm wondering if it might have something to do with the timezone.

EDIT (7/24): I injected the "date_default_timezone_get" command into the mythweb.php code and it reports the correct "America/NewYork" timezone.

Thanks
Last edited by kmpatel on Sun Jul 24, 2016 11:51 am, edited 1 time in total.

kmpatel
Newcomer
Posts: 13
Joined: Fri Nov 28, 2014 4:26 pm
United States of America

Re: Mythweb using wrong time/timezone

Post by kmpatel » Sun Jul 24, 2016 11:20 am

Help! Please! Anyone?

User avatar
bill6502
Developer
Posts: 1018
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Mythweb using wrong time/timezone

Post by bill6502 » Sun Jul 24, 2016 7:09 pm

Hi,

No idea why. I Googled: mythweb timezone and got some results. that may help.

Or, with 0.28, go to: yourBackendHostnameOrIP:6544. That's WebFrontend and
you can schedule programs from it (at least 'til you get mythweb your real question
answered.)

User avatar
stuarta
Developer
Posts: 192
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

Re: Mythweb using wrong time/timezone

Post by stuarta » Tue Jul 26, 2016 9:00 am

I'd check the timezone setting for your php installation. Should be under /etc/php or similar

kmpatel
Newcomer
Posts: 13
Joined: Fri Nov 28, 2014 4:26 pm
United States of America

Re: Mythweb using wrong time/timezone [solved?]

Post by kmpatel » Wed Dec 14, 2016 2:50 am

I found a fix to the problem. I cannot explain the underlying cause of the problem, but I debugged and found a hack to fix the problem.

I found that at onset of the execution of 'mythweb.php' script, PHP uses the correct system timezone. But somewhere in the execution of the initialization script 'include/init.php', the timezone is change to the wrong one (i.e. PST). The specific line that causes the problem is "MythBackend::find()->setTimezone();", near the end of init.php. I don't know how THAT line works (i.e. where it gets the timezone info) but my quick fix was simply to comment that line out. Now Mythweb works the correct system timezone without any other detrimental effects.

Deuce
Newcomer
Posts: 1
Joined: Wed Nov 15, 2017 1:59 am
Canada

Re: Mythweb using wrong time/timezone

Post by Deuce » Wed Nov 15, 2017 2:38 am

For posterity, I experienced the same issue, and it was caused by stale data in the mythweb_sessions table. Truncating the table and refreshing solved the problem.

Code: Select all

mysql -umythtv -p mythconverg -e 'TRUNCATE TABLE mythweb_sessions;' 

mtader
Newcomer
Posts: 1
Joined: Sat Apr 04, 2015 5:26 am
United States of America

Re: Mythweb using wrong time/timezone

Post by mtader » Mon Dec 25, 2017 3:26 am

Worked perfectly!!! Thanks

Post Reply