MCPcopy Index your code
hub / github.com/python/cpython / format_time

Function format_time

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

Source from the content-addressed store, hash-verified

357 return 1
358
359 def format_time(dt):
360 unit = time_unit
361
362 if unit is not None:
363 scale = units[unit]
364 else:
365 scales = [(scale, unit) for unit, scale in units.items()]
366 scales.sort(reverse=True)
367 for scale, unit in scales:
368 if dt >= scale:
369 break
370
371 return "%.*g %s" % (precision, dt / scale, unit)
372
373 if verbose:
374 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…