[mythtv-users] python bindings and timezones

Raymond Wagner raymond at wagnerrp.com
Sat Dec 29 01:54:51 UTC 2012


On 12/28/2012 18:06, Stephen Robertson wrote:
> There is something funny with my system and it seems to be related to
> timezones.
>
> As far as I can tell my system is set for the correct timezone:
>
> $ cat /etc/timezone
> Europe/London

The '/etc/timezone' file is not any standard behavior. Timezone data is 
stored in '/etc/localtime', and is actually a copy of the zoneinfo file, 
not just the name of one. Near as I can tell, '/etc/timezone' is just 
some particular behavior of Debian and company, used to pre-populate the 
TZ environmental variable, which is standard behavior and should be used 
by the python bindings but isn't.

>>>> recorded_list = list(db.searchRecorded(basename="7940_20121228185800.mpg"))
>>>> recorded_list
> [<Recorded 'Earthflight','2012-12-28 19:58:00+01:00' at 0xb663ee3cL>]

Since the python bindings are ignoring that TZ variable, either you have 
stored the wrong zoneinfo file in '/etc/localtime', or I screwed up the 
parser that reads and interprets those zoneinfo files. To be honest, 
this one could go either way.

> and is basically that I cannot delete recordings using the python bindings.

Now this part doesn't make much sense. The local timezone display in the 
python bindings is purely cosmetic. All communication with the database 
and backend is in UTC, and the local timezone conversion is only used 
for convenient display for the user. If the times are converted 
improperly in one direction, they should similarly be converted back 
improperly in the other direction, and deletes should work just fine. 
That is unless you are supplying the time that should be deleted, and 
the conversion is only happening one way. Without seeing the code, I 
can't know if this is the case.



More information about the mythtv-users mailing list