fix(ansible): better marking of times as formatted

This commit is contained in:
Michele Cereda
2025-02-08 14:53:07 +01:00
parent 56daea4c92
commit a01272ab6e
2 changed files with 9 additions and 5 deletions

View File

@@ -1,6 +1,9 @@
{ {
"editor.formatOnPaste": true, "editor.formatOnPaste": true,
"editor.formatOnSaveMode": "modificationsIfAvailable", "editor.formatOnSaveMode": "modificationsIfAvailable",
"editor.rulers": [
120
],
"json.schemas": [ "json.schemas": [
{ {
"fileMatch": [ "fileMatch": [

View File

@@ -870,14 +870,15 @@
- name: Take difference between dotnet (100ns precision) and iso8601 microsecond timestamps - name: Take difference between dotnet (100ns precision) and iso8601 microsecond timestamps
vars: vars:
date1: '2022-11-15T03:23:13.6869568Z' date1: '2022-11-15T03:23:13.6869568Z'
date2: '2021-12-15T16:06:24.400087Z' date2: '2021-12-15 16:06:24.400087Z'
date1_short: date1_short:
# Shorten to microseconds # Cap to microseconds for any timestamp with higher precision
# Works for any timestamp that has higher than microsecond precision by cutting off anything more precise than that '{{ date1 | regex_replace("([^.]+)(\.\d{6})\d*(.+)", "\1\2\3") }}'
'{{ date1 | regex_replace("([^.]+)(\.\d{6})(\d*)(.+)", "\1\2\4") }}'
iso8601format: '%Y-%m-%dT%H:%M:%S.%fZ' iso8601format: '%Y-%m-%dT%H:%M:%S.%fZ'
rfc3339format: '%Y-%m-%d %H:%M:%S.%fZ'
ansible.builtin.set_fact: ansible.builtin.set_fact:
date_diff_isoed: '{{ (date1_short|to_datetime(iso8601format) - date2|to_datetime(iso8601format)).total_seconds() }}' date_diff: >-
{{ (date1_short|to_datetime(iso8601format) - date2|to_datetime(rfc3339format)).total_seconds() }}
- name: AWS-specific operations - name: AWS-specific operations
tags: tags: