Closed djmattyg007 closed 7 years ago
This is harder than I expected it to be (especially if I want to continue support for py2, which I definitely want to).
I have a working protoype in the timezone-aware branch but it currently requires py3, because py2 doesn't support datetime.timezone
.
Given all timestamps in the teamspeak logs appear to be in UTC, and the difficulty of attempting to support this at all in python2 (I had no idea that python2 didn't have sensible timezone handling built in), perhaps it might be easier to just put the string 'UTC' into the default date format and be done with it?
It would work, yeah. But I don't really want to use such hacks, it wouldn't really solve the problem.
I'll see if I can find out how pytz
is implementing those things or just add it as a dependency and use it's implementation.
Fixed by reimplementing py3's timezone.utc
.
According to this, it's probably because the datetime object being formatted is naive (does not include timezone information):
https://docs.python.org/3/library/datetime.html?highlight=datetime#strftime-strptime-behavior