Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accumulate time #3

Closed
ianlini opened this issue Mar 26, 2019 · 0 comments
Closed

accumulate time #3

ianlini opened this issue Mar 26, 2019 · 0 comments
Assignees
Milestone

Comments

@ianlini
Copy link
Owner

ianlini commented Mar 26, 2019

Add a new instance variable cumulative_elapsed_time, and implement a new function like this:

timer = SimpleTimer()
with timer:
    sleep(1)
sleep(1)
with timer:
    sleep(1)
    print(timer.elapsed_time)  # 1 second
print(timer.cumulative_elapsed_time)  # 2 second

It will be useful when we want to evaluate the time of some block of code in a loop.

@ianlini ianlini added this to the 0.1.2 milestone Mar 26, 2019
@ianlini ianlini self-assigned this Mar 26, 2019
@ianlini ianlini removed this from the 0.2.0 milestone Mar 28, 2019
@ianlini ianlini closed this as completed Apr 17, 2019
@ianlini ianlini added this to the 0.2.0 milestone Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant