Updated formatting for elapsed time, #604
This commit is contained in:
@@ -81,6 +81,7 @@ from .utils import (
|
|||||||
expand_and_validate_filepath,
|
expand_and_validate_filepath,
|
||||||
load_function,
|
load_function,
|
||||||
normalize_fs_path,
|
normalize_fs_path,
|
||||||
|
format_sec_to_hhmmss,
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -2069,7 +2070,7 @@ def export(
|
|||||||
summary += f", touched date: {len(results.touched)}"
|
summary += f", touched date: {len(results.touched)}"
|
||||||
click.echo(summary)
|
click.echo(summary)
|
||||||
stop_time = time.perf_counter()
|
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:
|
else:
|
||||||
click.echo("Did not find any photos to export")
|
click.echo("Did not find any photos to export")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
""" Utility functions used in osxphotos """
|
""" Utility functions used in osxphotos """
|
||||||
|
|
||||||
|
import datetime
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import glob
|
import glob
|
||||||
import importlib
|
import importlib
|
||||||
@@ -447,3 +448,9 @@ def load_function(pyfile: str, function_name: str) -> Callable:
|
|||||||
sys.path = syspath
|
sys.path = syspath
|
||||||
|
|
||||||
return func
|
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]
|
||||||
|
|||||||
Reference in New Issue
Block a user