Skip to content

Commit

Permalink
Specify the timezone in timestamps
Browse files Browse the repository at this point in the history
fixes #1171
  • Loading branch information
evgeni committed Jan 3, 2022
1 parent 336b4c8 commit b099ee5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/1171-timezone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- callback plugin - include timezone information in the callback reported data (https://github.com/theforeman/foreman-ansible-modules/issues/1171)
4 changes: 3 additions & 1 deletion plugins/callback/foreman.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ def get_time():
def get_now():
"""
Return the current timestamp as a string to be sent over the network.
The time is always in UTC *with* timezone information, so that Ruby
DateTime can easily parse it.
"""
return datetime.utcnow().isoformat()
return datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S+00:00")


class CallbackModule(CallbackBase):
Expand Down

0 comments on commit b099ee5

Please sign in to comment.