[mythtv-commits] Ticket #10847: Time conversion error

MythTV noreply at mythtv.org
Wed Jun 20 13:21:50 UTC 2012


#10847: Time conversion error
----------------------------------------------+------------------------
     Reporter:  Andreas Reibring <andreas@…>  |      Owner:  wagnerrp
         Type:  Bug Report - General          |     Status:  new
     Priority:  minor                         |  Milestone:  unknown
    Component:  Bindings - Python             |    Version:  0.25-fixes
     Severity:  medium                        |   Keywords:
Ticket locked:  0                             |
----------------------------------------------+------------------------
 After upgrading to 0.25 my old scripts using
 `MythTV.MythXML.getProgramDetails()` stopped working, giving either
 `urllib2.HTTPError` or `httplib.BadStatusLine` errors. (Traceback from the
 Python interpreter attached.) The reason seems to be that
 `getProgramDetails()` now expects the `starttime` argument in UTC.
 However, when passed a UTC `starttime` argument, the method returns a
 `Program` object with an incorrect `starttime` attribute that is neither
 UTC nor local time.

 Example: The news program 'Rapport' starts at 19:30 local Swedish time
 (17:30 UTC).
 {{{
 #!python
 >>> prog = MythTV.MythXML().getProgramDetails(u'6011', u'2012-06-20
 17:30:00')
 >>> print prog.title, prog.starttime
 Rapport 2012-06-20 18:30:00
 }}}

 I believe that the problem is the time representation conversion in
 `MythTV.utility.datetime.timestamp()`. This method is calling
 `time.mktime()`, which expects a `struct_time` in local time as argument,
 with a `struct_time` in UTC. The problem can be resolved by calling
 `calendar.timegm()` instead. (See table on
 http://docs.python.org/library/time.html) Patch is attached.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10847>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list