Skip to content

Datetime format: Use suffix "Z" to indicate UTC when it applies, or use %z, but not both. #6

Description

@aaron-sweeney

I recommend rolling back the commit bc7e26f (logmatic/init.py) as per my comment to @lokoms.

The suffix "Z" indicates UTC and should not be used in combination with %z (+/-HHMM).

In cases where the system time zone is set to something other than UTC, for example US Mountain Standard Time, this change to line 21 (i.e. "Z%z") will result in nonsensical timestamps, such as "2016-12-18T16:42:03Z-0700." ("Z" indicates UTC, but -0700 indicates UTC-0700, so which is it?) As line 21 is calling the method utcnow(), you are assured that the timestamp is expressed in UTC, so the "Z" suffix will always apply. The "%z" should be removed from line 21.

Similarly, on line 11, introducing the suffix "Z" in combination with %z leads to confusion when the system time zone is not set to UTC. In this case, one is not guaranteed that the timestamp will be expressed as UTC, and so the suffix "Z" should not be included.

Cordially,
Aaron

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions