Skip to content

Commit

Permalink
Replace deprecated datetime.utcnow()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews committed Mar 19, 2024
1 parent c3ebad0 commit 5d947ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@


def current_time():
return datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
return datetime.datetime.now(datetime.UTC)


# use a custom JSON serializer so we can properly handle !unsafe and !vault
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def event_callback(self, event_data):

# prefer 'created' from partial data, but verbose events set time here
if 'created' not in event_data:
event_data['created'] = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat()
event_data['created'] = datetime.datetime.now(datetime.UTC).isoformat()

if self.event_handler is not None:
should_write = self.event_handler(event_data)
Expand Down

0 comments on commit 5d947ff

Please sign in to comment.