-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure we respect local system time #61
Conversation
This probably needs to be done on an api-interface by api-interface basis (as how we do it depends on how we convert whatever comes back into a datetime object). For the ciuk we have explicit UTC returned but strptime does not know how to parse this. So add the timezone info for each datetime object. Also modify the test to make sure all datetime objects we get back from the api_query are aware of their datetime (we don't care what this is, only that it is defined). We can then convert to system time at the other end.
Make all test data going into the unit tests for WindowedForcast have a timezone (specifically UTC) and add that timezone to the expected output. The existing assert statments will fail if timezone data does not match.
As far as I can tell, when using the posix timestamp to at, it works in local system time (which for me is BST). So make all our start times and reports from the optimiser timezone aware and in local system time. It turns out that all we need to do to do this is feed in a start time that is timezone aware and in the right timezone. Doing this shifts the time that gets passed generated for feeding into at by 1 hr, which is what we want. Also add a test case to test_windowed_forecast to make sure that this all works. Note that we have to explicitly check the timezones as the same time with different timezones compare equal.
I think this has everything we need to run correctly on systems where the system time is not UTC but the forecast data is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @andreww ! It's really amazing to see that you can 'specify the start time in whatever timezone and all the comparisons between datetime
objects under the hood work as expected.
This documents the need for two checks for timezone awarness, and makes one of the more complex forecast checks cross timezones between the data and 'system' time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are tests
and the ticks are green
I think this should go in
This (draft) pull request makes sure we keep track of any differences in timezone between system time (e.g. used for
at
) and the time zone returned by our datasource. To do this, we need to:With a little luck, the actual calculation will 'just work'. We should check this.
This addresses #21