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