Re: [ansible-devel] Machine readable duration

2021-08-03 Thread Matthew Kenigsberg
Makes sense. If it weren't for backwards compatibility I would definitely vote duration is machine readable, but maybe that's an issue with str(timedelta). Guess I'll just use regex 🤷 On Tue, Aug 3, 2021 at 1:31 PM Brian Coca wrote: > Understood, we were not aware of the python bug when closing

Re: [ansible-devel] Machine readable duration

2021-08-03 Thread Matthew Kenigsberg
That doesn't work for longer periods of time: "2 days, 2:02:02.02" It's definitely possible to parse (right now I'm using regex in Python), it's just annoying to have to manually write a regex for a non-standard format unique to Python timedeltas On Tuesday, August 3, 2021 at 12:47:15 PM UTC

Re: [ansible-devel] Machine readable duration

2021-08-03 Thread Brian Coca
I was not aware of the datetime bug (was thinking to_datetime & strftime), but it is still simple to do in jinja: - debug: msg='{{seconds}}' vars: d: "{{res['delta'].split(':')}}" seconds : "{{ d[0]|int * 3600 + d[1]|int * 60 + d[2]|float }}" -- Brian Coca -- You