Skip to content

Fix lock expiration and seconds remaining when lock passes 24 hours old #1

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

Merged
merged 1 commit into from
Apr 13, 2012

Conversation

jwhitlock
Copy link

datetime.timedelta() normalizes times to days and seconds within a day. For example, if a time delta is 86401 seconds, then td.seconds is 1. The way to get absolute seconds is to mutliply td.days by seconds in a day, and then add in seconds. In python 2.7, there is a timedelta.total_seconds() call that does this math for you.

Because is_locked and lock_seconds_remaining only looked at the seconds, they behave strangely around day barriers.

I've tested this change against the 0.3 codebase, which we're using, but not 1.0. The tests should work, (and some fail without the change), but someone should try it.

RobCombs added a commit that referenced this pull request Apr 13, 2012
Fix lock expiration and seconds remaining when lock passes 24 hours old.

Thanks for looking into this!  I haven't had a chance to test it but if I notice any issues, I'll let you know.
@RobCombs RobCombs merged commit 5747379 into RobCombs:master Apr 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants