Junior — Senior
Decorator measuring the execution duration of a function in specified units
livecode
Task condition
It is necessary to implement a decorator that takes a parameter — a unit of time measurement (for example, "ms" or "s") — and logs the duration of the function's execution in the specified unit.
import time
def time_duration_unit():
pass
@time_duration_unit("ms")
def work_function():
print("start work function work function")
time.sleep(2)
print("end work function. work function")
work_function()