mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 22:39:09 -07:00
time_filter: allow 0 to return 0 (#4612)
* time_filter: allow 0 to return 0 * add changelog * Update changelogs/fragments/4612-time_filter_zero.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
8d37591605
commit
dd9afc09a8
3 changed files with 14 additions and 0 deletions
|
@ -46,6 +46,11 @@ def multiply(factors):
|
|||
|
||||
def to_time_unit(human_time, unit='ms', **kwargs):
|
||||
''' Return a time unit from a human readable string '''
|
||||
|
||||
# No need to handle 0
|
||||
if human_time == "0":
|
||||
return 0
|
||||
|
||||
unit_to_short_form = UNIT_TO_SHORT_FORM
|
||||
unit_factors = UNIT_FACTORS
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue