Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 21 months ago

Closed 17 months ago

Last modified 17 months ago

#10995 closed Patch - Bug Fix (fixed)

Myth 0.26 Wakes up late - mythshutdown UTC

Reported by: jksjdevelop@… Owned by: danielk
Priority: minor Milestone: 0.26.1
Component: MythTV - General Version: Master Head
Severity: medium Keywords: mythshutdown
Cc: Ticket locked: no

Description

While testing [v0.26-beta-9-g8c551e6] on Ubunu 12.04, I note that the machine wakes up later than it should to record. I suspect that the recent changes to UTC have not made it into mythshutdown. Mythbackend log shows the following.

Aug 10 10:05:37 tv mythlogserver: mythbackend[1461]: N Scheduler scheduler.cpp:2947 (ShutdownServer?) Running the command to set the next scheduled wakeup time :-#012#011#011#011#011#011#011sudo mythshutdown --setwakeup 2012-08-10T11:15:00
Aug 10 10:05:38 tv mythlogserver: mythbackend[1461]: N Scheduler scheduler.cpp:2974 (ShutdownServer?) Running the command to shutdown this computer :-#012#011#011#011#011#011#011mythshutdown --shutdown
Aug 10 12:16:10 tv mythlogserver: mythbackend[1875]: C thread_unknown mythcommandlineparser.cpp:2545 (ConfigureLogging?) mythbackend version: master [v0.26-beta-9-g8c551e6] www.mythtv.org

The programme was due to start at 11:25 and I have set the backend to wakeup 10 mins prior to program start. Wake up time was correctly set to 11:15 but the backend actually started at 12:16. This mechanism works fine with myth 0.25.
Note that this anomaly only affects startup, programs are scheduled at the correct time when the backend is already up.

Time zones are set correctly. I am located in the UK.

mysql> SELECT CONVERT_TZ('2012-08-10 12:45', 'GB', 'America/New_York');
+----------------------------------------------------------+
| CONVERT_TZ('2012-08-10 12:45', 'GB', 'America/New_York') |
+----------------------------------------------------------+
| 2012-08-10 07:45:00 |
+----------------------------------------------------------+
1 row in set (0.10 sec)

Attachments (3)

mythshutdown-utc-fix.patch (778 bytes) - added by anonymous 19 months ago.
10995-v1.patch (4.3 KB) - added by danielk 18 months ago.
fix, needs testing
10995-v2.patch (4.3 KB) - added by danielk 18 months ago.
Changes default for setwakeup to localtime

Download all attachments as: .zip

Change History (14)

comment:1 Changed 20 months ago by j.suarez.agapito@…

I am not having this problem. I have just created a new scheduled recording, let the backend shutdown and mythtv woke up at the correct time.


I am located in a different time zone (mainland Spain - GMT+1, currently +2 due to DST), though, and using Mythbuntu 12.04.1 with 0.26 repos (rev 20120904.b5fbc74). This is a clean install I did yesterday (I just copied the recording mysql tables from the old installation to the new one).


Just to compare, this is the output of my mysql TZ conversion:


mysql> SELECT CONVERT_TZ('2012-08-10 12:45', 'Europe/Madrid?', 'America/New_York');

+---------------------------------------------------------------------+

| CONVERT_TZ('2012-08-10 12:45', 'Europe/Madrid?', 'America/New_York') |

+---------------------------------------------------------------------+

| 2012-08-10 06:45:00 |

+---------------------------------------------------------------------+

1 row in set (0.01 sec)


Both results seem correct (UK is one hour behind Madrid) but my machine wakes up correctly.


Should further information be needed (I will check my set-alarm script tomorrow), please let me know, I will be happy to help.


Kind regards,
José

comment:2 Changed 20 months ago by jksjdevelop@…

A recent change has fixed this, the fault is definitely gone in master [v0.26-rc2-9-g14fbeb5].
Thanks please close.

comment:3 Changed 20 months ago by kenni

  • Milestone changed from unknown to 0.26
  • Resolution set to Fixed
  • Status changed from new to closed

Thank you for reporting back.

comment:4 Changed 19 months ago by Doug Mackay <douglas.mackay@…>

I'm still seeing this problem.

MythTV Version : v0.26-rc2-20-g91c3e66
MythTV Branch : master
Network Protocol : 75
Library API : 0.26.20120822-1
QT Version : 4.8.1
Options compiled in:

linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_ceton using_hdpvr using_iptv using_ivtv using_joystick_menu using_libcec using_libcrypto using_libdns_sd using_libxml2 using_lirc using_mheg using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_v4l2 using_x11 using_xrandr using_xv using_bindings_perl using_bindings_python using_bindings_php using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_live using_mheg using_libass using_libxml2

In versions of mythtv previous to 0.26 I've used the following settings to write the time to the bios ACPI wakeup alarm

Mythbackend Shutdown/Wakeup? Options

Command to set Wakeup Time: mythshutdown --setwakeup $time

Mythshutdown settings

Command to Set Wakeup Time: sudo /usr/bin/setwakeup.sh $time

Wakeup time format: time_t

I'm in the Europer/London? timezone which, due to daylight savings, is currently UTC + 1

The bios time is UTC so setwakeup.sh simply writes the time_t value to the wakeup alarm. I've set setwakep.sh to log info to the backend log (see below)

Log extract

Sep 18 18:44:54 media mythlogserver: mythbackend[1892]: N Scheduler scheduler.cpp:2946 (ShutdownServer?) Running the command to set the next scheduled wakeup time :- mythshutdown --setwakeup 2012-09-18T19:24:40

Sep 18 18:44:55 media mythlogserver: mythbackend[1892]: N Scheduler scheduler.cpp:2973 (ShutdownServer?) Running the command to shutdown this computer :- mythshutdown --shutdown

Running /usr/bin/setwakeup.sh to set the wakeup time to 1347996280

rtc_time : 17:44:55

rtc_date : 2012-09-18

alrm_time : 19:24:40

alrm_date : 2012-09-18

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 : yes

BCD : yes

DST_enable : no

periodic_freq : 1024

batt_status : okay

[Machine manually started]

Sep 18 19:43:14 media mythlogserver:

From the above log at 18:44:55 localtime (17:44:55 UTC) mythshutdown called the setwakeup.sh script and passed 1347996280 (19:24:20 UTC). The proper wakeup time
should of been 1 hour earlier 19:24:20 localtime (18:24:20 UTC). It looks like the backend 'Command to set wakup time' is sending a locatime which is then sent onto the setwakep.sh script still as localtime.

Changed 19 months ago by anonymous

comment:5 Changed 19 months ago by toepi@…

  • Resolution Fixed deleted
  • Status changed from closed to new

Same scenario her, mythbackend should call mythsutdown --setwakup $time to set next wakeuptime. But mythbackend use localtime, but mythshutdown handle it as utc. I think mythshutdown should handle time set via command line as localtime. I've attach a patch (mythshutdown-utc-fix.patch​), that fix this circumstance.

The Question is, should mythbakend call --setschedwakeup insead of --setwakeup?

comment:6 Changed 19 months ago by kenni

  • Milestone changed from 0.26 to 0.26.1
  • Owner set to danielk
  • Status changed from new to assigned
  • Type changed from Bug Report - General to Patch - Bug Fix

comment:7 Changed 19 months ago by kenni

  • Milestone changed from 0.26.1 to unknown

comment:8 Changed 18 months ago by danielk

  • Milestone changed from unknown to 0.26.1

Additional info:

(07:39:23 PM) wagnerrp: danielk22: bit of a problem with the shutdown/autowakeup code and the UTC change
(07:40:42 PM) wagnerrp: http://code.mythtv.org/cgit/mythtv/tree/mythtv/programs/mythbackend/scheduler.cpp#n2942 we convert the shutdown time to local time, and feed it to mythshutdown
(07:41:12 PM) wagnerrp: http://code.mythtv.org/cgit/mythtv/tree/mythtv/programs/mythshutdown/main.cpp#n387 we immediately assume the time being fed to mythshutdown is UTC

Changed 18 months ago by danielk

fix, needs testing

Changed 18 months ago by danielk

Changes default for setwakeup to localtime

comment:9 Changed 17 months ago by Daniel Thor Kristjansson <danielk@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In ef7810c473e36d1022b62b1b411abf8efd49aa68/mythtv:

Fix #10995. Default to local time for mythshutdown --setwakeup.

comment:10 Changed 17 months ago by martin.thelian@…

Is it possible to get this fix also into the fixes/0.26 branch?

comment:11 Changed 17 months ago by Daniel Thor Kristjansson <danielk@…>

In b28041a11711a2ddd9eb63f8eee0c1ce3009c4ac/mythtv:

Fix #10995. Default to local time for mythshutdown --setwakeup.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.