Closed Echelon9 closed 7 years ago
Is there anything that we can do to improve things with regards to timezones?
There are options, but they involve bringing in extra dependencies for just the one test.
Yeah that might be a bit unnecessary and I can't really remember if these ANT dates had a specified timezone or not now. How about just doing if sys.version_info >= (3,4)
?
Alright, so I think I've finally sorted the timezone issues as best as possible in a Python2.x and Python3.x manner, without resorting to additional external dependencies.
Fundamentally, without supplying timezone information at the point a datetime
object is created (a 'naive' or 'unaware' `datetime object) there is little that can be done later to convert to a common timezone, as there's no reference point to shift off from.
Accordingly, within ant.fs.file.File()
the UTC timezone is now set for the datetime
object parsed off the device (an 'aware' datetime
object).
See further:
Apologies from the coveralls spam whilst I got this working across Python 2.x to Python 3.x.
Thank you, I'm really happy with this. Yeah, timezones are a mess, generally speaking and python could really be better at handling them -- but it is a hard topic to solve in a good way.