Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LocalDispatcher, LocalJobs : Fix timezone handling
Before, the Properties tab was showing the correct time in the local timezone, and the Start Time column was showing the wrong thing. The difference is that the Properties tab was formatted directly in Python, whereas the column went through a conversion to `IECore::DataTimeData` and then on to `QDateTime` for display. DateTimeData stores a `boost::posix_time::ptime` instance internally, which store time in UTC. The wrapper that constructs that from a Python `datetime` assumes that the Python value is also stored in UTC, but that was not the case in our code - we were instead using "naive" objects which didn't record timezone data, and which only we knew were in local time. The solution is to store time in UTC in Python, by passing a timezone to `now()`. Using UTC also has the benefit of insulating us from changes to the system timezone made during a Job's runtime, which would otherwise be causing us to compare start and end times from different timezones and return bogus results. > Note : This isn't quite the whole story. Even when given a non-naive `datetime` object which records its timezone, the DataTimeData bindings still assume that it is stored in UTC. We should make the DateTimeData bindings convert to UTC appropriately using the timezone information, but that can wait for another day. Either way, we would still be wanting to store as UTC in Python.
- Loading branch information