From ae988e23f38145565f9c21bd360feb586e85698c Mon Sep 17 00:00:00 2001 From: Juan Tovar Date: Sun, 2 Aug 2020 20:40:13 -0700 Subject: [PATCH] =?UTF-8?q?Solved=20by=20Juan=20Jos=C3=A9=20Tovar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- challenge.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/challenge.py b/challenge.py index c69287d..799928f 100644 --- a/challenge.py +++ b/challenge.py @@ -1,8 +1,19 @@ import time -def finish_date(): +def finish_date(func): # You have to code here!! + def wrapper(*args, **kwargs): + + initial_time = time.time() + func(*args, **kwargs) + final_time = time.time() + duration = final_time - initial_time + local_time = time.localtime() + finalization_time = time.strftime("%d/%m/%Y - %H:%M:%S", local_time) + print('Function {} ended its execution at: {} . And it took {} seconds to be executed'.format(func.__name__, finalization_time, round(duration, 6))) + + return wrapper @finish_date