Skip to content
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

Merged
merged 4 commits into from
Aug 11, 2023

Commits on Aug 10, 2023

  1. Make sure our timestamps are timezone aware

    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.
    andreww committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    b583e71 View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2023

  1. Update all the tests for the forcast to have tzs

    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.
    andreww committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    c673898 View commit details
    Browse the repository at this point in the history
  2. Report times in the local system timezone

    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.
    andreww committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    757746a View commit details
    Browse the repository at this point in the history
  3. Update tests for timezones

    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.
    andreww committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    76b09e5 View commit details
    Browse the repository at this point in the history