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

Use utcnow instead of now #4192

Merged
merged 2 commits into from
Jul 26, 2019
Merged

Use utcnow instead of now #4192

merged 2 commits into from
Jul 26, 2019

Conversation

AlexandreYang
Copy link
Member

@AlexandreYang AlexandreYang commented Jul 24, 2019

What does this PR do?

Use utcnow instead of now to avoid possible DST and timezone issues.

Motivation

Additional Notes

Review checklist (to be filled by reviewers)

  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached
  • Feature or bugfix must have tests
  • Git history must be clean
  • If PR adds a configuration option, it must be added to the configuration file.

@codecov
Copy link

codecov bot commented Jul 24, 2019

1 similar comment
@codecov
Copy link

codecov bot commented Jul 24, 2019

@codecov
Copy link

codecov bot commented Jul 24, 2019

@AlexandreYang AlexandreYang marked this pull request as ready for review July 25, 2019 08:49
@AlexandreYang AlexandreYang requested review from a team as code owners July 25, 2019 08:49
@@ -34,7 +34,7 @@ def __init__(self, name, init_config, agentConfig, instances=None):

def check(self, instance):
self.log.info("Starting Cisco Check")
start = datetime.datetime.now()
start = datetime.datetime.utcnow()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case is a bit irrelevant because it is just used to calculate a time delta

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might prevent the edge case when we have a DST change on local machine between start and end, we might not have the right delta.

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

Successfully merging this pull request may close these issues.

None yet

3 participants