Skip to content

Commit

Permalink
Merge pull request #6 from raharper/fix/iostat-time-format-24h
Browse files Browse the repository at this point in the history
Use %H for output generated with iostat -t
  • Loading branch information
t2y authored Jan 13, 2024
2 parents 27fef3c + 4884547 commit 5562211
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions iostat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def parse_datetime(s, fmt='%Y%m%d%H%M%S'):
>>> parse_datetime('06/13/2018 02:10:50 PM', fmt='%m/%d/%Y %I:%M:%S %p')
datetime.datetime(2018, 6, 13, 14, 10, 50)
>>> parse_datetime('09/26/21 03:35:19', fmt='%m/%d/%y %I:%M:%S')
datetime.datetime(2021, 9, 26, 3, 35, 19)
>>> parse_datetime('09/26/21 13:35:19', fmt='%m/%d/%y %H:%M:%S')
datetime.datetime(2021, 9, 26, 13, 35, 19)
"""
return datetime.strptime(s, fmt)

Expand All @@ -32,7 +32,7 @@ def parse_datetime(s, fmt='%Y%m%d%H%M%S'):
(?P<date>^\d{2}/\d{2}/\d{4}\s*\d{2}:\d{2}:\d{2}\s*(AM|PM))
""", re.VERBOSE)

IOSTAT_DATE_FORMAT_JA = '%m/%d/%y %I:%M:%S'
IOSTAT_DATE_FORMAT_JA = '%m/%d/%y %H:%M:%S'
IOSTAT_DATE_JA = re.compile(r"""
(?P<date>^\d{2}/\d{2}/\d{2}\s*\d{2}:\d{2}:\d{2})
""", re.VERBOSE)
Expand All @@ -42,8 +42,8 @@ def get_iostat_date_format(s):
"""
>>> get_iostat_date_format('06/13/2018 02:10:50 PM')
'%m/%d/%Y %I:%M:%S %p'
>>> get_iostat_date_format('09/26/21 03:35:19')
'%m/%d/%y %I:%M:%S'
>>> get_iostat_date_format('09/26/21 13:35:19')
'%m/%d/%y %H:%M:%S'
>>> get_iostat_date_format('09/26/2021 03:35:19') is None
True
"""
Expand Down

0 comments on commit 5562211

Please sign in to comment.