Ticket #9937 (closed Bug Report - General: fixed)
Opened 22 months ago
Last modified 15 months ago
MythTV datetime class shouldn't have nested tzinfo class
|Reported by:||richardfearn@…||Owned by:||wagnerrp|
|Component:||Bindings - Python||Version:||0.24-fixes|
MythTV.utility.datetime has a nested class, tzinfo. This means the tzinfo attribute of datetime instances is the tzinfo type. However, this attribute is supposed to be a tzinfo instance. The datetime library gets confused by this.
It would be better to move tzinfo out of the datetime class, so that the tzinfo attribute can be an instance, or None.
For example, when MythTV creates a datetime object using a timestamp, tzinfo should be None, as there is no timestamp information. However tzinfo is the tzinfo class. A workaround is to copy the datetime object:
mythtv_time = prog.starttime # for example new_time = datetime.fromtimestamp(mythtv_time.timestamp())
I found this while fixing an issue in mythcal.
comment:1 Changed 22 months ago by wagnerrp
- Status changed from new to accepted
comment:2 Changed 22 months ago by Github
- Status changed from accepted to closed
- Resolution set to fixed
comment:3 Changed 22 months ago by wagnerrp
- Milestone changed from 0.24.1 to 0.24.2
comment:4 Changed 15 months ago by stuartm
- Milestone 0.24.2 deleted