Updated formatting for elapsed time, #604

This commit is contained in:
Rhet Turnbull 2022-01-29 11:05:33 -08:00
parent 5fc28139ea
commit 16d3f74366
2 changed files with 9 additions and 1 deletions

View File

@ -81,6 +81,7 @@ from .utils import (
expand_and_validate_filepath,
load_function,
normalize_fs_path,
format_sec_to_hhmmss,
)
__all__ = [
@ -2069,7 +2070,7 @@ def export(
summary += f", touched date: {len(results.touched)}"
click.echo(summary)
stop_time = time.perf_counter()
click.echo(f"Elapsed time: {(stop_time-start_time):.3f} seconds")
click.echo(f"Elapsed time: {format_sec_to_hhmmss(stop_time-start_time)}")
else:
click.echo("Did not find any photos to export")

View File

@ -1,5 +1,6 @@
""" Utility functions used in osxphotos """
import datetime
import fnmatch
import glob
import importlib
@ -447,3 +448,9 @@ def load_function(pyfile: str, function_name: str) -> Callable:
sys.path = syspath
return func
def format_sec_to_hhmmss(sec: float) -> str:
"""Format seconds to hh:mm:ss"""
delta = datetime.timedelta(seconds=sec)
return str(delta).split(".")[0]