{"action":"opened","number":70,"pull_request":{"url":"https://api.github.com/repos/reinh/statsd/pulls/70","id":181836421,"html_url":"https://github.com/reinh/statsd/pull/70","diff_url":"https://github.com/reinh/statsd/pull/70.diff","patch_url":"https://github.com/reinh/statsd/pull/70.patch","issue_url":"https://api.github.com/repos/reinh/statsd/issues/70","number":70,"state":"open","locked":false,"title":"Fix incorrect time measurement by using monotonic time","user":{"login":"kyrylo","id":1079123,"avatar_url":"https://avatars2.githubusercontent.com/u/1079123?v=4","gravatar_id":"","url":"https://api.github.com/users/kyrylo","html_url":"https://github.com/kyrylo","followers_url":"https://api.github.com/users/kyrylo/followers","following_url":"https://api.github.com/users/kyrylo/following{/other_user}","gists_url":"https://api.github.com/users/kyrylo/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrylo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrylo/subscriptions","organizations_url":"https://api.github.com/users/kyrylo/orgs","repos_url":"https://api.github.com/users/kyrylo/repos","events_url":"https://api.github.com/users/kyrylo/events{/privacy}","received_events_url":"https://api.github.com/users/kyrylo/received_events","type":"User","site_admin":false},"body":"`Statsd#time` uses the `Time` class to measure the difference between\r\nelapsed time. This is incorrect because `Time.now` uses realtime,\r\nwhich is meant to be used for system clock.\r\n\r\n`clock_gettime` from `time.h` supports *monotonic time*. Let me quote\r\nthe man page of `clock_gettime` man to demonstrate the difference\r\nbetween them:\r\n\r\n> CLOCK_REALTIME\r\n> the system's real time (i.e. wall time) clock, expressed as the\r\n> amount of time since the Epoch.\r\n\r\n> CLOCK_MONOTONIC\r\n> clock that increments monotonically, tracking the time since an\r\n> arbitrary point, and will continue to increment while the system is\r\n> asleep.\r\n\r\nSince we measure elapsed time, we should be using monotonic time,\r\nsince it more accurate and meant to be used for that reason.","created_at":"2018-04-16T11:54:22Z","updated_at":"2018-04-16T11:54:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/reinh/statsd/pulls/70/commits","review_comments_url":"https://api.github.com/repos/reinh/statsd/pulls/70/comments","review_comment_url":"https://api.github.com/repos/reinh/statsd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reinh/statsd/issues/70/comments","statuses_url":"https://api.github.com/repos/reinh/statsd/statuses/58211ed7c547e6d98dc9f6b17c03d17b1fb2634f","head":{"label":"kyrylo:monotonic-clock","ref":"monotonic-clock","sha":"58211ed7c547e6d98dc9f6b17c03d17b1fb2634f","user":{"login":"kyrylo","id":1079123,"avatar_url":"https://avatars2.githubusercontent.com/u/1079123?v=4","gravatar_id":"","url":"https://api.github.com/users/kyrylo","html_url":"https://github.com/kyrylo","followers_url":"https://api.github.com/users/kyrylo/followers","following_url":"https://api.github.com/users/kyrylo/following{/other_user}","gists_url":"https://api.github.com/users/kyrylo/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrylo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrylo/subscriptions","organizations_url":"https://api.github.com/users/kyrylo/orgs","repos_url":"https://api.github.com/users/kyrylo/repos","events_url":"https://api.github.com/users/kyrylo/events{/privacy}","received_events_url":"https://api.github.com/users/kyrylo/received_events","type":"User","site_admin":false},"repo":{"id":129735087,"name":"statsd","full_name":"kyrylo/statsd","owner":{"login":"kyrylo","id":1079123,"avatar_url":"https://avatars2.githubusercontent.com/u/1079123?v=4","gravatar_id":"","url":"https://api.github.com/users/kyrylo","html_url":"https://github.com/kyrylo","followers_url":"https://api.github.com/users/kyrylo/followers","following_url":"https://api.github.com/users/kyrylo/following{/other_user}","gists_url":"https://api.github.com/users/kyrylo/gists{/gist_id}","starred_url":"https://api.github.com/users/kyrylo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyrylo/subscriptions","organizations_url":"https://api.github.com/users/kyrylo/orgs","repos_url":"https://api.github.com/users/kyrylo/repos","events_url":"https://api.github.com/users/kyrylo/events{/privacy}","received_events_url":"https://api.github.com/users/kyrylo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kyrylo/statsd","description":"A Ruby Statsd client that isn't a direct port of the Python example code. Because Ruby isn't Python.","fork":true,"url":"https://api.github.com/repos/kyrylo/statsd","forks_url":"https://api.github.com/repos/kyrylo/statsd/forks","keys_url":"https://api.github.com/repos/kyrylo/statsd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kyrylo/statsd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kyrylo/statsd/teams","hooks_url":"https://api.github.com/repos/kyrylo/statsd/hooks","issue_events_url":"https://api.github.com/repos/kyrylo/statsd/issues/events{/number}","events_url":"https://api.github.com/repos/kyrylo/statsd/events","assignees_url":"https://api.github.com/repos/kyrylo/statsd/assignees{/user}","branches_url":"https://api.github.com/repos/kyrylo/statsd/branches{/branch}","tags_url":"https://api.github.com/repos/kyrylo/statsd/tags","blobs_url":"https://api.github.com/repos/kyrylo/statsd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kyrylo/statsd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kyrylo/statsd/git/refs{/sha}","trees_url":"https://api.github.com/repos/kyrylo/statsd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kyrylo/statsd/statuses/{sha}","languages_url":"https://api.github.com/repos/kyrylo/statsd/languages","stargazers_url":"https://api.github.com/repos/kyrylo/statsd/stargazers","contributors_url":"https://api.github.com/repos/kyrylo/statsd/contributors","subscribers_url":"https://api.github.com/repos/kyrylo/statsd/subscribers","subscription_url":"https://api.github.com/repos/kyrylo/statsd/subscription","commits_url":"https://api.github.com/repos/kyrylo/statsd/commits{/sha}","git_commits_url":"https://api.github.com/repos/kyrylo/statsd/git/commits{/sha}","comments_url":"https://api.github.com/repos/kyrylo/statsd/comments{/number}","issue_comment_url":"https://api.github.com/repos/kyrylo/statsd/issues/comments{/number}","contents_url":"https://api.github.com/repos/kyrylo/statsd/contents/{+path}","compare_url":"https://api.github.com/repos/kyrylo/statsd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kyrylo/statsd/merges","archive_url":"https://api.github.com/repos/kyrylo/statsd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kyrylo/statsd/downloads","issues_url":"https://api.github.com/repos/kyrylo/statsd/issues{/number}","pulls_url":"https://api.github.com/repos/kyrylo/statsd/pulls{/number}","milestones_url":"https://api.github.com/repos/kyrylo/statsd/milestones{/number}","notifications_url":"https://api.github.com/repos/kyrylo/statsd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kyrylo/statsd/labels{/name}","releases_url":"https://api.github.com/repos/kyrylo/statsd/releases{/id}","deployments_url":"https://api.github.com/repos/kyrylo/statsd/deployments","created_at":"2018-04-16T11:53:22Z","updated_at":"2018-04-16T11:53:24Z","pushed_at":"2018-04-16T11:53:45Z","git_url":"git://github.com/kyrylo/statsd.git","ssh_url":"git@github.com:kyrylo/statsd.git","clone_url":"https://github.com/kyrylo/statsd.git","svn_url":"https://github.com/kyrylo/statsd","homepage":"","size":128,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reinh:master","ref":"master","sha":"4c11cc48ca02032401d59ac105e75e343b1e4130","user":{"login":"reinh","id":52,"avatar_url":"https://avatars3.githubusercontent.com/u/52?v=4","gravatar_id":"","url":"https://api.github.com/users/reinh","html_url":"https://github.com/reinh","followers_url":"https://api.github.com/users/reinh/followers","following_url":"https://api.github.com/users/reinh/following{/other_user}","gists_url":"https://api.github.com/users/reinh/gists{/gist_id}","starred_url":"https://api.github.com/users/reinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinh/subscriptions","organizations_url":"https://api.github.com/users/reinh/orgs","repos_url":"https://api.github.com/users/reinh/repos","events_url":"https://api.github.com/users/reinh/events{/privacy}","received_events_url":"https://api.github.com/users/reinh/received_events","type":"User","site_admin":false},"repo":{"id":1385128,"name":"statsd","full_name":"reinh/statsd","owner":{"login":"reinh","id":52,"avatar_url":"https://avatars3.githubusercontent.com/u/52?v=4","gravatar_id":"","url":"https://api.github.com/users/reinh","html_url":"https://github.com/reinh","followers_url":"https://api.github.com/users/reinh/followers","following_url":"https://api.github.com/users/reinh/following{/other_user}","gists_url":"https://api.github.com/users/reinh/gists{/gist_id}","starred_url":"https://api.github.com/users/reinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinh/subscriptions","organizations_url":"https://api.github.com/users/reinh/orgs","repos_url":"https://api.github.com/users/reinh/repos","events_url":"https://api.github.com/users/reinh/events{/privacy}","received_events_url":"https://api.github.com/users/reinh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reinh/statsd","description":"A Ruby Statsd client that isn't a direct port of the Python example code. Because Ruby isn't Python.","fork":false,"url":"https://api.github.com/repos/reinh/statsd","forks_url":"https://api.github.com/repos/reinh/statsd/forks","keys_url":"https://api.github.com/repos/reinh/statsd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reinh/statsd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reinh/statsd/teams","hooks_url":"https://api.github.com/repos/reinh/statsd/hooks","issue_events_url":"https://api.github.com/repos/reinh/statsd/issues/events{/number}","events_url":"https://api.github.com/repos/reinh/statsd/events","assignees_url":"https://api.github.com/repos/reinh/statsd/assignees{/user}","branches_url":"https://api.github.com/repos/reinh/statsd/branches{/branch}","tags_url":"https://api.github.com/repos/reinh/statsd/tags","blobs_url":"https://api.github.com/repos/reinh/statsd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reinh/statsd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reinh/statsd/git/refs{/sha}","trees_url":"https://api.github.com/repos/reinh/statsd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reinh/statsd/statuses/{sha}","languages_url":"https://api.github.com/repos/reinh/statsd/languages","stargazers_url":"https://api.github.com/repos/reinh/statsd/stargazers","contributors_url":"https://api.github.com/repos/reinh/statsd/contributors","subscribers_url":"https://api.github.com/repos/reinh/statsd/subscribers","subscription_url":"https://api.github.com/repos/reinh/statsd/subscription","commits_url":"https://api.github.com/repos/reinh/statsd/commits{/sha}","git_commits_url":"https://api.github.com/repos/reinh/statsd/git/commits{/sha}","comments_url":"https://api.github.com/repos/reinh/statsd/comments{/number}","issue_comment_url":"https://api.github.com/repos/reinh/statsd/issues/comments{/number}","contents_url":"https://api.github.com/repos/reinh/statsd/contents/{+path}","compare_url":"https://api.github.com/repos/reinh/statsd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reinh/statsd/merges","archive_url":"https://api.github.com/repos/reinh/statsd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reinh/statsd/downloads","issues_url":"https://api.github.com/repos/reinh/statsd/issues{/number}","pulls_url":"https://api.github.com/repos/reinh/statsd/pulls{/number}","milestones_url":"https://api.github.com/repos/reinh/statsd/milestones{/number}","notifications_url":"https://api.github.com/repos/reinh/statsd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reinh/statsd/labels{/name}","releases_url":"https://api.github.com/repos/reinh/statsd/releases{/id}","deployments_url":"https://api.github.com/repos/reinh/statsd/deployments","created_at":"2011-02-19T03:19:53Z","updated_at":"2018-04-03T21:37:08Z","pushed_at":"2018-04-12T11:26:23Z","git_url":"git://github.com/reinh/statsd.git","ssh_url":"git@github.com:reinh/statsd.git","clone_url":"https://github.com/reinh/statsd.git","svn_url":"https://github.com/reinh/statsd","homepage":"","size":128,"stargazers_count":396,"watchers_count":396,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":199,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":199,"open_issues":5,"watchers":396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reinh/statsd/pulls/70"},"html":{"href":"https://github.com/reinh/statsd/pull/70"},"issue":{"href":"https://api.github.com/repos/reinh/statsd/issues/70"},"comments":{"href":"https://api.github.com/repos/reinh/statsd/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/reinh/statsd/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/reinh/statsd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reinh/statsd/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/reinh/statsd/statuses/58211ed7c547e6d98dc9f6b17c03d17b1fb2634f"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":39,"deletions":2,"changed_files":2}}
{"actor":{"display_login":"kyrylo"}}