-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Add Duration type to std and use it in Timer methods. #15934
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5778ed4
std: Add a Duration type
brson 657b679
std: Rename sleep, periodic, and oneshot timers to sleep_ms, etc.
brson dc8b23b
std: Add sleep, oneshot and periodic timers, taking Duration
brson 18f75a9
std: Add comments to the time module
brson 6cb2093
std: Update Duration from upstream
brson 51e9728
std: Change time::MAX to time::MAX_DURATION, etc.
brson 1666dab
std: Remove ms-taking methods from timers
brson 8a5fe86
std: Remove the `zero` constructor from `Duration`
brson 734834c
std: Restore missing timer examples
brson 63cd4ac
std: Clarify what timers do with zero and negative durations
brson 9fdcddb
std: Make the TCP/UDP connect_timeout methods take Duration
brson 4475e6a
std: connect_timeout requires a positive Duration
brson 77cdaf0
std: Refactor time module a bit
brson 80d3243
Fix compiletest to use Duration
brson a391934
Fix various fallout from timer changes
brson ee10f35
std: Make connect_timeout return Err on zero duration
brson c6b02f6
std: Improve Duration comments
brson 500b600
std: Remove Duration::new/new_opt/to_tuple
brson 31281b4
std: Fix build errors
brson 49a40d8
Update docs
brson 02e39b0
Add a fixme about Duration representation
brson 075256a
Fix test fallout
brson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
std: Make the TCP/UDP connect_timeout methods take Duration
[breaking-change]
- Loading branch information
commit 9fdcddb3178d4705db4aee5ee12c05796203658c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just
ms.to_u64().unwrap_or(0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code works fine.