Whole file

kellyjonbrazil/jc

The author described this change as fix time parser for missing centiseconds. It counts as a record because the check below fails on the code as it stood at e9ccedf0d and passes on 1c09289d9, with nothing else changed between the two runs.

Fix saved2025-03-31
Sharing licenceMIT · LICENSE.md
Change size+9 4

What the code was meant to do, written into the code itself as a save note

fix time parser for missing centiseconds

The change

132132
133133 class info():
134134 """Provides parser metadata (version, author, etc.)"""
135- version = '1.4'
135+ version = '1.5'
136136 description = '`/usr/bin/time` command parser'
137137 author = 'Kelly Brazil'
138138 author_email = 'kellyjonbrazil@gmail.com'
171171 proc_data['command_being_timed'] = proc_data['command_being_timed'][1:-1]
172172
173173 if 'elapsed_time' in proc_data:
174- proc_data['elapsed_time'] = proc_data['elapsed_time'].replace('.', ':')
175- *hours, minutes, seconds, centiseconds = proc_data['elapsed_time'].split(':')
176- proc_data['elapsed_time'] = proc_data['elapsed_time'][::-1].replace(':', '.', 1)[::-1]
174+ *hours, minutes, ss = proc_data['elapsed_time'].split(':')
175+ if '.' in ss:
176+ seconds, centiseconds = ss.split('.')
177+ else:
178+ seconds = ss
179+ centiseconds = '0'
180+
177181 if hours:
178182 proc_data['elapsed_time_hours'] = jc.utils.convert_to_int(hours[0])
179183 else:
180184 proc_data['elapsed_time_hours'] = 0
185+
181186 proc_data['elapsed_time_minutes'] = jc.utils.convert_to_int(minutes)
182187 proc_data['elapsed_time_seconds'] = jc.utils.convert_to_int(seconds)
183188 proc_data['elapsed_time_centiseconds'] = jc.utils.convert_to_int(centiseconds)

The check that tells the two apart

failpass·tests/test_time.py::MyTests::test_time_no_centiseconds

Check file tests/test_time.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ite9ccedf0d7a745a41f4101199433378a26cb1e38
Broken version dated2025-03-30
Modulejc.parsers.time
Units changed_process, info
Fingerprint60308fb45e8463f5
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in kellyjonbrazil/jc