GitHub PullRequestReviewCommentEvent at 2014-07-24 03:13:54
Repository: rust
Actor: kballard
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/15328184","id":15328184,"diff_hunk":"@@ -0,0 +1,431 @@\n+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT\n+// file at the top-level directory of this distribution and at\n+// http://rust-lang.org/COPYRIGHT.\n+//\n+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n+// option. This file may not be copied, modified, or distributed\n+// except according to those terms.\n+\n+//! Temporal quantification\n+\n+#![experimental]\n+#![allow(missing_doc)] // FIXME\n+\n+use {fmt, num, i32};\n+use option::{Option, Some, None};\n+use result::{Result, Ok, Err};\n+use ops::{Neg, Add, Sub, Mul, Div};\n+use num::{CheckedAdd, ToPrimitive};\n+\n+pub static MIN_DAYS: i32 = i32::MIN;\n+pub static MAX_DAYS: i32 = i32::MAX;\n+\n+static NANOS_PER_SEC: i32 = 1_000_000_000;\n+static SECS_PER_DAY: i32 = 86400;\n+\n+macro_rules! earlyexit(\n+    ($e:expr) => (match $e { Some(v) => v, None => return None })\n+)\n+\n+/// The representation of a span of time.\n+///\n+/// This type has nanosecond precision, and conforms to the ISO 8601\n+/// standard for Date interchange.\n+#[deriving(PartialEq, Eq, PartialOrd, Ord)]\n+pub struct Duration {\n+    days: i32,\n+    secs: u32,\n+    nanos: u32,\n+}\n+\n+impl Duration {\n+    /// Create a new `Duration`.\n+    pub fn new(days: i32, secs: i32, nanos: i32) -> Option<Duration> {\n+        let (secs_, nanos) = div_mod_floor(nanos, NANOS_PER_SEC);\n+        let secs = earlyexit!(secs.checked_add(&secs_));\n+        let (days_, secs) = div_mod_floor(secs, SECS_PER_DAY);\n+        let days = earlyexit!(days.checked_add(&days_).and_then(|v| v.to_i32()));","path":"src/libstd/time.rs","position":49,"original_position":49,"commit_id":"5e56470dce00227ea1a390ce4500e63415ce9dd1","original_commit_id":"5e56470dce00227ea1a390ce4500e63415ce9dd1","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?","gravatar_id":"6451ee8093c9cedc94f6c813b4dde2c5","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"body":"`days` is already `i32`, the `to_i32()` here is pointless.","created_at":"2014-07-24T03:13:54Z","updated_at":"2014-07-24T03:13:54Z","html_url":"https://github.com/rust-lang/rust/pull/15934#discussion_r15328184","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/15934","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/15328184"},"html":{"href":"https://github.com/rust-lang/rust/pull/15934#discussion_r15328184"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/15934"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/15934","id":18813114,"html_url":"https://github.com/rust-lang/rust/pull/15934","diff_url":"https://github.com/rust-lang/rust/pull/15934.diff","patch_url":"https://github.com/rust-lang/rust/pull/15934.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/15934","number":15934,"state":"open","title":"Add Duration type to std and use it in Timer methods.","user":{"login":"brson","id":147214,"avatar_url":"https://avatars.githubusercontent.com/u/147214?","gravatar_id":"d0ce8e171d43e20591074a66e9ff7ae6","url":"https://api.github.com/users/brson","html_url":"https://github.com/brson","followers_url":"https://api.github.com/users/brson/followers","following_url":"https://api.github.com/users/brson/following{/other_user}","gists_url":"https://api.github.com/users/brson/gists{/gist_id}","starred_url":"https://api.github.com/users/brson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brson/subscriptions","organizations_url":"https://api.github.com/users/brson/orgs","repos_url":"https://api.github.com/users/brson/repos","events_url":"https://api.github.com/users/brson/events{/privacy}","received_events_url":"https://api.github.com/users/brson/received_events","type":"User","site_admin":false},"body":"Currently, the Timer methods take an integer number of ms. This is considered a bug because a) types, b) some timers have ns precision.\r\n\r\nThis plucks the `Duration` type from [rust-chrono](https://github.com/lifthrasiir/rust-chrono), plops it into `std::time`,  and replaces the arguments to `sleep`, `oneshot`, and `periodic` timers with it. It leaves the old methods intact as `sleep_ms`, `oneshot_ms`, and `periodic_ms`, for convenience.\r\n\r\nCloses https://github.com/rust-lang/rust/issues/11189.\r\n\r\ncc @lifthrasiir @aturon @kballard @alexcrichton","created_at":"2014-07-24T01:18:59Z","updated_at":"2014-07-24T03:13:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56c93247db3194efab734861b0cee40755a91e0c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/15934/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/15934/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/15934/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/5e56470dce00227ea1a390ce4500e63415ce9dd1","head":{"label":"brson:dur","ref":"dur","sha":"5e56470dce00227ea1a390ce4500e63415ce9dd1","user":{"login":"brson","id":147214,"avatar_url":"https://avatars.githubusercontent.com/u/147214?","gravatar_id":"d0ce8e171d43e20591074a66e9ff7ae6","url":"https://api.github.com/users/brson","html_url":"https://github.com/brson","followers_url":"https://api.github.com/users/brson/followers","following_url":"https://api.github.com/users/brson/following{/other_user}","gists_url":"https://api.github.com/users/brson/gists{/gist_id}","starred_url":"https://api.github.com/users/brson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brson/subscriptions","organizations_url":"https://api.github.com/users/brson/orgs","repos_url":"https://api.github.com/users/brson/repos","events_url":"https://api.github.com/users/brson/events{/privacy}","received_events_url":"https://api.github.com/users/brson/received_events","type":"User","site_admin":false},"repo":{"id":779820,"name":"rust","full_name":"brson/rust","owner":{"login":"brson","id":147214,"avatar_url":"https://avatars.githubusercontent.com/u/147214?","gravatar_id":"d0ce8e171d43e20591074a66e9ff7ae6","url":"https://api.github.com/users/brson","html_url":"https://github.com/brson","followers_url":"https://api.github.com/users/brson/followers","following_url":"https://api.github.com/users/brson/following{/other_user}","gists_url":"https://api.github.com/users/brson/gists{/gist_id}","starred_url":"https://api.github.com/users/brson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brson/subscriptions","organizations_url":"https://api.github.com/users/brson/orgs","repos_url":"https://api.github.com/users/brson/repos","events_url":"https://api.github.com/users/brson/events{/privacy}","received_events_url":"https://api.github.com/users/brson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brson/rust","description":"pursuing the trifecta","fork":true,"url":"https://api.github.com/repos/brson/rust","forks_url":"https://api.github.com/repos/brson/rust/forks","keys_url":"https://api.github.com/repos/brson/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brson/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brson/rust/teams","hooks_url":"https://api.github.com/repos/brson/rust/hooks","issue_events_url":"https://api.github.com/repos/brson/rust/issues/events{/number}","events_url":"https://api.github.com/repos/brson/rust/events","assignees_url":"https://api.github.com/repos/brson/rust/assignees{/user}","branches_url":"https://api.github.com/repos/brson/rust/branches{/branch}","tags_url":"https://api.github.com/repos/brson/rust/tags","blobs_url":"https://api.github.com/repos/brson/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brson/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brson/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/brson/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brson/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/brson/rust/languages","stargazers_url":"https://api.github.com/repos/brson/rust/stargazers","contributors_url":"https://api.github.com/repos/brson/rust/contributors","subscribers_url":"https://api.github.com/repos/brson/rust/subscribers","subscription_url":"https://api.github.com/repos/brson/rust/subscription","commits_url":"https://api.github.com/repos/brson/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/brson/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/brson/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/brson/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/brson/rust/contents/{+path}","compare_url":"https://api.github.com/repos/brson/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brson/rust/merges","archive_url":"https://api.github.com/repos/brson/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brson/rust/downloads","issues_url":"https://api.github.com/repos/brson/rust/issues{/number}","pulls_url":"https://api.github.com/repos/brson/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/brson/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/brson/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brson/rust/labels{/name}","releases_url":"https://api.github.com/repos/brson/rust/releases{/id}","created_at":"2010-07-16T23:45:53Z","updated_at":"2014-07-20T23:15:33Z","pushed_at":"2014-07-24T01:17:17Z","git_url":"git://github.com/brson/rust.git","ssh_url":"git@github.com:brson/rust.git","clone_url":"https://github.com/brson/rust.git","svn_url":"https://github.com/brson/rust","homepage":"http://www.rust-lang.org","size":197597,"stargazers_count":3,"watchers_count":3,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"fb72c4767fa423649feeb197b50385c1fa0a6fd5","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?","gravatar_id":"a4268b59e433144466a0f67cbcfd8cdc","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?","gravatar_id":"a4268b59e433144466a0f67cbcfd8cdc","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"a safe, concurrent, practical language","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","created_at":"2010-06-16T20:39:03Z","updated_at":"2014-07-24T03:13:28Z","pushed_at":"2014-07-24T02:16:13Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"http://www.rust-lang.org","size":410076,"stargazers_count":5840,"watchers_count":5840,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1181,"mirror_url":null,"open_issues_count":1779,"forks":1181,"open_issues":1779,"watchers":5840,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/15934"},"html":{"href":"https://github.com/rust-lang/rust/pull/15934"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/15934"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/15934/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/15934/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/15934/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/5e56470dce00227ea1a390ce4500e63415ce9dd1"}}}}