Helly1206 / service.hts.pvrmanager

Poweroff management for current active recordings and wakeup procedures for future schedules using the XML-Interface of TVHeadend.
GNU General Public License v2.0
4 stars 0 forks source link

Timezone problems #3

Closed hobbypunk90 closed 8 years ago

hobbypunk90 commented 8 years ago

Hey, it's me again :D

i have a problem, not sure if its with your addon directly... i think its a problem with the timezone, i set Berlin (+2) on my htpc, now, when it should wake up at 6 o'clock, it wakes up at 8. i thinks the main problem is, that linux uses the localtime as hardware time. i hope you can fix this ;) :D

greets, Marcel

Helly1206 commented 8 years ago

Hi Hobbypunk,

That is quite strange. I'm running in the same time zone and do not have any issues. I'm running ubuntu 14.04. I use the datetime module in python to get and calculate the time. It calculates the time to start a recording or EPG update as an offset from the current time. timetuple recalculates to the UT time (no daylight saving time).

Your hardware clock should be running UT time. Maybe that's something you need to check on your linux system.

My 'datetimectl' output: Local time: Sun 2015-11-01 17:14:33 CET Universal time: Sun 2015-11-01 16:14:33 UTC Timezone: Europe/Amsterdam (CET, +0100) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: no Last DST change: DST ended at Sun 2015-10-25 02:59:59 CEST Sun 2015-10-25 02:00:00 CET Next DST change: DST begins (the clock jumps one hour forward) at Sun 2016-03-27 01:59:59 CET Sun 2016-03-27 03:00:00 CEST

Be free to send me your output, so I can check your hardware clock time.

Greets, Helly.

Helly1206 commented 8 years ago

Hi Hobbypunk,

Any results yet? Please inform me, otherwise I will close this issue in a few days.

Helly.

hobbypunk90 commented 8 years ago

Sorry, I'm not at home yet. I'll check it tomorrow evening

hobbypunk90 commented 8 years ago

damn it, sorry, i'm really late -.- my timedatectl: Local time: Mo 2015-11-16 18:46:35 CET Universal time: Mo 2015-11-16 17:46:35 UTC RTC time: Mo 2015-11-16 17:46:34 Time zone: Europe/Berlin (CET, +0100) Network time on: no NTP synchronized: yes RTC in local TZ: no

i checked my log again, the first, my system should startup at 6, it starts up at 8 :-/ and i got this: 08:00:30 T:140480016910080 ERROR: service.hts.pvrmanager: HTTP/1.1 1 Unknown Code 08:00:30 T:140480016910080 NOTICE: service.hts.pvrmanager: Remaining connection attempts to http://localhost:9981/status.xml: 4 08:00:30 T:140479253444352 NOTICE: Thread PVRGUIInfo start, auto delete: false 08:00:30 T:140479485900544 NOTICE: Thread FileCache start, auto delete: false 08:00:32 T:140478950053632 NOTICE: Thread EPGUpdater start, auto delete: false 08:00:32 T:140480000124672 NOTICE: Start - EPG thread started 08:00:35 T:140480016910080 ERROR: service.hts.pvrmanager: HTTP/1.1 1 Unknown Code 08:00:35 T:140480016910080 NOTICE: service.hts.pvrmanager: Remaining connection attempts to http://localhost:9981/status.xml: 3 08:00:39 T:140479476721408 NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:10 08:00:40 T:140480016910080 ERROR: service.hts.pvrmanager: HTTP/1.1 1 Unknown Code 08:00:40 T:140480016910080 NOTICE: service.hts.pvrmanager: Remaining connection attempts to http://localhost:9981/status.xml: 2 08:00:45 T:140480016910080 ERROR: service.hts.pvrmanager: HTTP/1.1 1 Unknown Code 08:00:45 T:140480016910080 NOTICE: service.hts.pvrmanager: Remaining connection attempts to http://localhost:9981/status.xml: 1 08:00:47 T:140479485900544 NOTICE: Thread FileCache start, auto delete: false 08:00:53 T:140480016910080 ERROR: service.hts.pvrmanager: HTTP/1.1 1 Unknown Code 08:00:53 T:140480016910080 NOTICE: service.hts.pvrmanager: Remaining connection attempts to http://localhost:9981/status.xml: 0

and the log from tvheadend:

Nov 15 08:00:30 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 401 Nov 15 08:00:30 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 1 Nov 15 08:00:35 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 401 Nov 15 08:00:35 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 1 Nov 15 08:00:38 vogsphere tvheadend[525]: mpegts: 12031.5H in Astra 19.2E - tuning on TechnoTrend TT connect S-2400 (2) Nov 15 08:00:38 vogsphere tvheadend[525]: subscription: 0001: "epggrab" unsubscribing Nov 15 08:00:38 vogsphere tvheadend[525]: subscription: 0003: "scan" subscribing to mux "12031.5H", weight: 5, adapter: "TechnoTrend TT connect S-2400 (2)", network: Nov 15 08:00:38 vogsphere tvheadend[525]: mpegts: mux 12721.75H in Astra 19.2E changed from DVBS2 19.2E freq 12721750 H sym 23500000 fec 2/3 mod PSK/8 roff 35 is_id Nov 15 08:00:38 vogsphere tvheadend[525]: mpegts: mux 12721.75H in Astra 19.2E changed to DVBS2 19.2E freq 12721750 H sym 23500000 fec 2/3 mod PSK/8 roff 20 is_id Nov 15 08:00:40 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 401 Nov 15 08:00:40 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 1 Nov 15 08:00:45 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 401 Nov 15 08:00:45 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 1 Nov 15 08:00:50 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 401 Nov 15 08:00:50 vogsphere tvheadend[525]: http: 127.0.0.1: HTTP/1.1 GET /status.xml:9981/status.xml -- 1

i hope it helps

Helly1206 commented 8 years ago

Hi HobbyPunk,

Sorry for the late reply, but I was abroad for work this week.

I think the next thing is to check whether the issue is pvr-manager related or maybe related to your os-settings. I'm sorry to bother you with some tests, but you really help me making the addon better as I cannot reproduce the behavior at my system.

Could you enter a time at http://www.unixtimestamp.com/ as time you want to start -up your system, any time that's convenient for your to test. Take care it needs to be universal time (so one hour earlier than the timezone you are living in).

After that: enter in a terminal: rtcwake -lt -m no

Without the brackets of course.

Can you check the wakeup-time afterwards with: cat /proc/driver/rtc and send me the results.

shutdown your system (with sudo shutdown -h now or similar not via kodi. Shutting down via kodi overwrites the wakup time)

Check if the system wakes up at the correct time.

Thanks.

Helly.

hobbypunk90 commented 8 years ago

ok, first test: i want to wake up at 18:30, so i convert for 17:30, i got this: 1480181400 i entered: rtcwake -m no -lt 1480181400 i get from rtcwake: rtcwake: wakeup using /dev/rtc0 at Sat Nov 26 19:30:01 2016 which is an hour to late 0o the rtc time is 17:24, so i was wrong, my arch has UTC as rtc_time^^"

here the cat /proc/driver/rtc rtc_time : 17:24:09 rtc_date : 2015-11-26 alrm_time : 19:30:01 alrm_date : 2016-11-26 alarm_IRQ : yes alrm_pending : no update IRQ enabled : no periodic IRQ enabled : no periodic IRQ frequency : 1024 max user IRQ frequency : 64 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : no BCD : yes DST_enable : no periodic_freq : 1024 batt_status : okay

when i use the same rtcwake command on my notebook, i get also 19:30 and not 18:30... it's no problem, i hope we can help us, whereever the problme is ;) :D

Helly1206 commented 8 years ago

Hi Hobbypunk,

I think I've found the cause of your issue. You have probably the hardware clock set to UTC. This is default for arch. I am running ubuntu which defaults to localtime (for windows compatibility on dual boot systems).

However the hardware clock doesn't know in which time zone it's running and every linux distribution may store the information on a different place, which doesn't make it easy for automatic checking.

Could you please try the test again, but instead of entering: rtcwake -m no -lt

enter: rtcwake -m no -ut

(still use your local time - 1 hour converted to unix timestamp)

Please let me know if it works. If it works, you can change it in .kodi/addons/service.hts.pvrmanager/resources/lib/settimer.sh Then you have everything working for now.

I will make an option for local/ utc time in a next release.

Thanks, Helly.

hobbypunk90 commented 8 years ago

you are right :) with -ut it works :) now i change it in the settimer.sh file and test it again ;) :D

hobbypunk90 commented 8 years ago

hey, i tested it with -ut, now my htpc wakes up at 6o'clock, when it should wake up at 5 :-/ i found an other bug :D your delay between the connection tries to tvheadend are always at 5 seconds not at the 14 seconds that i set in the settings.

hobbypunk90 commented 8 years ago

ok, i tested now your addon with -ut now it works, my htpc starts at the given time and shutdown after my configured 20 minutes, great :) :D

Helly1206 commented 8 years ago

Hi Hobbypunk,

Glad it works now. Do you know what was the issue with waking up one hour late the first time?

I've found a bug in the connection retries delay. I will solve it in the next release. Then I will also make an option to select either RTC on UTC or localtime.

Thanks for helping me debugging the addon.

Helly.

hobbypunk90 commented 8 years ago

i'm not sure, perhaps i only generated the wrong timestamp^^" i'm glad that i can help you ;) and i found an other little bug, i think^^