Fix: Allow for -0
Offset
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
04d513705d
commit
3d0a70c3e4
1 changed files with 4 additions and 2 deletions
|
@ -25,6 +25,7 @@ KEY_OFFSET = 'Offset'
|
|||
KEY_PARSED_OFFSET = 'Parsed Offset'
|
||||
|
||||
mult = {
|
||||
'': 1.0,
|
||||
's': 1.0,
|
||||
'ms': 1.0 / 1000.0,
|
||||
'us': 1.0 / 1000000.0,
|
||||
|
@ -40,8 +41,9 @@ def get_stats():
|
|||
desc, cont = line_parts
|
||||
stats[desc.strip()] = cont.strip()
|
||||
|
||||
groups = re.search(r'^([+-])([0-9.]+)([a-z]+)$',
|
||||
stats[KEY_OFFSET]).groups()
|
||||
search = re.search(r'^([+-])([0-9.]+)([a-z]*)$',
|
||||
stats[KEY_OFFSET])
|
||||
groups = search.groups()
|
||||
offset = float(groups[1])
|
||||
offset = offset * mult[groups[2]]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue