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

Refactored EventLoop::timeout_ms to use Duration instead of u64 #48

Merged
merged 1 commit into from
Nov 13, 2014

Conversation

zslayton
Copy link
Contributor

Addresses #32. Removed _ms from the method name since the Duration class can represent a range of units.

@zslayton zslayton changed the title Refactored EventLoop::timeout_ms to use Duration instead of uint. Refactored EventLoop::timeout_ms to use Duration instead of u64 Nov 12, 2014
@sschepens
Copy link

I was thinking of dropping a pull request for this too, we have to be careful when casting i64 to u64, if it's negative it will give a huve positive u64, maybe we can error o reject negative i64s? or maybe set timeout to 0 when it's negative

@zslayton
Copy link
Contributor Author

I considered this -- in honesty, I'm not sure why Duration uses signed values. I'm not sure what it would mean to have a negative duration of time. "Two days ago" is still a duration of two days. Perhaps I should open a ticket upstream to discuss it.

In the meantime, @carllerche, how would you prefer that this case be handled?

@sschepens
Copy link

Yeah, i also thought about it, it's kind of misleading to have negative durations but, but golang seems to have them too and there are some use cases where it's actually handy to have negative durations.

@carllerche
Copy link
Member

For now, if the duration is negative, I would set a 0ms timeout. I would also open an issue upstream. I am going to discuss this issue with @aturon. Besides that, the PR looks good. Thanks

@zslayton
Copy link
Contributor Author

I've started a thread on discuss.rust-lang.org. I'll tweak the PR to set a 0ms timeout this evening.

@carllerche
Copy link
Member

THanks for the PR :)

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.

3 participants