Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Commits

Ticket #10847: Time conversion error

 

 

MythTV commits RSS feed   Index | Next | Previous | View Threaded


noreply at mythtv

Jun 20, 2012, 6:21 AM

Post #1 of 3 (98 views)
Permalink
Ticket #10847: Time conversion error

#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
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Aug 18, 2012, 7:10 PM

Post #2 of 3 (66 views)
Permalink
Re: Ticket #10847: Time conversion error [In reply to]

#10847: Time conversion error
------------------------------------------+----------------------------
Reporter: Andreas Reibring <andreas@…> | Owner: wagnerrp
Type: Bug Report - General | Status: accepted
Priority: minor | Milestone: 0.26
Component: Bindings - Python | Version: 0.25-fixes
Severity: medium | Resolution:
Keywords: | Ticket locked: 0
------------------------------------------+----------------------------
Changes (by wagnerrp):

* status: new => accepted
* milestone: unknown => 0.26


--
Ticket URL: <http://code.mythtv.org/trac/ticket/10847#comment:1>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Sep 1, 2012, 2:31 PM

Post #3 of 3 (55 views)
Permalink
Re: Ticket #10847: Time conversion error [In reply to]

#10847: Time conversion error
------------------------------------------+-----------------------------
Reporter: Andreas Reibring <andreas@…> | Owner: wagnerrp
Type: Bug Report - General | Status: accepted
Priority: minor | Milestone: unknown
Component: Bindings - Python | Version: Master Head
Severity: medium | Resolution:
Keywords: | Ticket locked: 0
------------------------------------------+-----------------------------
Changes (by wagnerrp):

* version: 0.25-fixes => Master Head
* milestone: 0.26 => unknown


Comment:

In [changeset:b393cbc969f26c470e0ae38e48d9780b67dad604/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="b393cbc969f26c470e0ae38e48d9780b67dad604"
Complete timezone handling in Python bindings following UTC change.

This adds proper timezone handling to the Python bindings, parsing zone
information out of the system TZif files. On systems without those
tables available, the code will revert to a simple offset, yielding
potentially inaccurate times when used on old recordings.

All user interaction with datetimes will be in local time, unless forced
otherwise by a timezone-aware datetime object. Times are converted to
UTC automatically for interfacing with MySQL and mythbackend.

Refs #10847

I'm leaving this ticket open for now, as the timezones will still need
to be created in a different manner on Windows, and potentially OSX.
}}}

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10847#comment:2>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits

MythTV commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.