(dt)
| 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))) |