[mythtv-users] python bindings and timezones

Stephen Robertson stephengrobertson at gmail.com
Sat Dec 29 21:33:01 UTC 2012


On Sat, Dec 29, 2012 at 6:09 PM, Raymond Wagner <raymond at wagnerrp.com> wrote:
> On 12/29/2012 06:05, Stephen Robertson wrote:
>>>
>>> recorded
>>
>> <Recorded 'Earthflight','2012-12-28 19:58:00+01:00' at 0x89f9e3c>
>>>
>>> program =
>>> be.getRecording(chanid=recorded.chanid,starttime=recorded.starttime)
>>> program
>>
>> <Program 'Earthflight','2012-12-28 20:00:00+01:00' at 0x89fddac>
>
>
> Well that's certainly odd.  I'll take a look into that...
>
I've been stumbling around and bit and thought I would share what I have found.

In dt.py (line195)
offset = -(time.timezone, time.altzone)[time.daylight]
seems to be where the hour comes from.offset here is set to
-3600(seconds)  changing it to
offset = -(time.timezone, time.altzone)[0] and running my test code
gives time values as I expect and lets me delete recordings.

I'm not quite sure how to interpret that line.  Is it trying to
establish whether we are in daylight savings time and work out what
offset to use?  Or is it saying, what's the offset to use if I later
decide that we are in daylight savings?

If it is the former then it doesn't quite work as time.daylight
indicates whether there is a DST timezone defined rather than whether
it is active.  Though thinking about that some more it's not likely
that is the case as this would only tell us if we were currently in
DST rather than was DST in force at the time we are manipulating.

As I say, I've been stumbling around so this is probably of no
relevance but I thought I would share in case it pointed you towards
anything.

Cheers
Stephen


More information about the mythtv-users mailing list