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