from functools import wraps
import time


class TimeIt:
    def __init__(self):
        self.cur_time = 0
        self.max_time = 0



def timeit(obj):
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            time_start = time.time()
            result = func(*args, **kwargs)
            time_release = time.time() - time_start 
            if time_release > obj.max_time:
                obj.max_time = time_release
            obj.cur_time = time_release
            return result
        return wrapper
    return decorator



delta = TimeIt()

@timeit(delta)
def test_func():
    time.sleep(1.5)


def main():

    test_func()
    print(delta.time)




if __name__ == '__main__':
    main()