Update developing_plugins.rst (#72305)

##### SUMMARY
ansible_date_time returns utc time. datetime.utcnow() rather than datetime.now()

##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
pull/72653/head
Marco Lembo 4 years ago committed by GitHub
parent 570aed0913
commit 1937dd5e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -130,7 +130,7 @@ For example, if you wanted to check the time difference between your Ansible con
if remote_date: if remote_date:
remote_date_obj = datetime.strptime(remote_date, '%Y-%m-%dT%H:%M:%SZ') remote_date_obj = datetime.strptime(remote_date, '%Y-%m-%dT%H:%M:%SZ')
time_delta = datetime.now() - remote_date_obj time_delta = datetime.utcnow() - remote_date_obj
ret['delta_seconds'] = time_delta.seconds ret['delta_seconds'] = time_delta.seconds
ret['delta_days'] = time_delta.days ret['delta_days'] = time_delta.days
ret['delta_microseconds'] = time_delta.microseconds ret['delta_microseconds'] = time_delta.microseconds

Loading…
Cancel
Save