MCPcopy Index your code
hub / github.com/RustPython/RustPython / format_time

Function format_time

Lib/timeit.py:341–353  ·  view source on GitHub ↗
(dt)

Source from the content-addressed store, hash-verified

339 return 1
340
341 def format_time(dt):
342 unit = time_unit
343
344 if unit is not None:
345 scale = units[unit]
346 else:
347 scales = [(scale, unit) for unit, scale in units.items()]
348 scales.sort(reverse=True)
349 for scale, unit in scales:
350 if dt >= scale:
351 break
352
353 return "%.*g %s" % (precision, dt / scale, unit)
354
355 if verbose:
356 print("raw times: %s" % ", ".join(map(format_time, raw_timings)))

Callers 1

mainFunction · 0.85

Calls 2

itemsMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected