{"action":"created","comment":{"url":"https://api.github.com/repos/PolySat/libproc/pulls/comments/191097992","pull_request_review_id":123606871,"id":191097992,"diff_hunk":"@@ -0,0 +1,129 @@\n+/*\n+ * Copyright PolySat, California Polytechnic State University, San Luis Obispo. cubesat@calpoly.edu\n+ * This file is part of libproc, a PolySat library.\n+ *\n+ * This program is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU Lesser General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+#ifndef _EVENT_TIMER_H_\n+#define _EVENT_TIMER_H_\n+\n+#include <sys/time.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#define VIRT_CLK_ENABLED 1\n+#define VIRT_CLK_DISABLED 0\n+\n+#define VIRT_CLK_PAUSED 1\n+#define VIRT_CLK_ACTIVE 0\n+\n+/**\n+ * The EventTimer abstraction allows the libproc event loop to\n+ * be agnostic of time. This allows virtualization of the event\n+ * loop so programs can be run in accelerated time.\n+ *\n+ * There are two EventTimer implementations provided, the default\n+ * EventTimer and the virtual EventTimer. The default EventTimer produces\n+ * the behavior expected of libproc event loop. The virtual EventTimer\n+ * immediately executes timed events and maintains a virtual time that\n+ * can be accessed using EVT_get_gmt_time or EVT_get_monotonic_time. Execution\n+ * of fd events is the same as the default EventTimer.\n+ */\n+struct EventTimer {\n+   /**\n+    * Block the event loop until either a file event occurs or the time stored \n+    * in nextAwake elapses.\n+    */\n+   int (*block)(struct EventTimer *et, struct timeval *nextAwake,\n+          int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds);","path":"eventTimer.h","position":52,"original_position":52,"commit_id":"94c0d7707dc37e6c7e8f0579ee4cefec9e53c810","original_commit_id":"32346784fda5de590e7755fd7e68e321d2eaedf4","user":{"login":"johnbellardo","id":5756789,"avatar_url":"https://avatars2.githubusercontent.com/u/5756789?v=4","gravatar_id":"","url":"https://api.github.com/users/johnbellardo","html_url":"https://github.com/johnbellardo","followers_url":"https://api.github.com/users/johnbellardo/followers","following_url":"https://api.github.com/users/johnbellardo/following{/other_user}","gists_url":"https://api.github.com/users/johnbellardo/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbellardo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbellardo/subscriptions","organizations_url":"https://api.github.com/users/johnbellardo/orgs","repos_url":"https://api.github.com/users/johnbellardo/repos","events_url":"https://api.github.com/users/johnbellardo/events{/privacy}","received_events_url":"https://api.github.com/users/johnbellardo/received_events","type":"User","site_admin":false},"body":"Or a function pointer and a void *. But that may be slightly over complicated because it is harder to use local variables in the caller function.","created_at":"2018-05-28T02:03:16Z","updated_at":"2018-05-28T02:03:16Z","html_url":"https://github.com/PolySat/libproc/pull/8#discussion_r191097992","pull_request_url":"https://api.github.com/repos/PolySat/libproc/pulls/8","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/comments/191097992"},"html":{"href":"https://github.com/PolySat/libproc/pull/8#discussion_r191097992"},"pull_request":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/8"}},"in_reply_to_id":191090221},"pull_request":{"url":"https://api.github.com/repos/PolySat/libproc/pulls/8","id":169538403,"html_url":"https://github.com/PolySat/libproc/pull/8","diff_url":"https://github.com/PolySat/libproc/pull/8.diff","patch_url":"https://github.com/PolySat/libproc/pull/8.patch","issue_url":"https://api.github.com/repos/PolySat/libproc/issues/8","number":8,"state":"open","locked":false,"title":"Implement EventTimer abstraction to add virtual time api for adcs simulation","user":{"login":"lucbouchard1","id":10227519,"avatar_url":"https://avatars2.githubusercontent.com/u/10227519?v=4","gravatar_id":"","url":"https://api.github.com/users/lucbouchard1","html_url":"https://github.com/lucbouchard1","followers_url":"https://api.github.com/users/lucbouchard1/followers","following_url":"https://api.github.com/users/lucbouchard1/following{/other_user}","gists_url":"https://api.github.com/users/lucbouchard1/gists{/gist_id}","starred_url":"https://api.github.com/users/lucbouchard1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucbouchard1/subscriptions","organizations_url":"https://api.github.com/users/lucbouchard1/orgs","repos_url":"https://api.github.com/users/lucbouchard1/repos","events_url":"https://api.github.com/users/lucbouchard1/events{/privacy}","received_events_url":"https://api.github.com/users/lucbouchard1/received_events","type":"User","site_admin":false},"body":"This PR allows popping timed events off the queue in succession for accelerated simulations. I also added some tests to verify my changes did not break the event loop.\r\n\r\n@Joshua-Anderson This is a complete refactor of #6, but I think it is a much stronger design. I think it addresses all of your concerns while also making the virtual time thing much less of a hack. The idea is that an EventTimer is an arbitrary interface that manages the triggering of events. To change the timing, we just swap out the interface. This will allow to transition to more complex simulation frameworks in the future.","created_at":"2018-02-16T02:50:46Z","updated_at":"2018-05-28T02:03:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"959dcf0549270a59899ff63494f696ede23db0e7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PolySat/libproc/pulls/8/commits","review_comments_url":"https://api.github.com/repos/PolySat/libproc/pulls/8/comments","review_comment_url":"https://api.github.com/repos/PolySat/libproc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PolySat/libproc/issues/8/comments","statuses_url":"https://api.github.com/repos/PolySat/libproc/statuses/94c0d7707dc37e6c7e8f0579ee4cefec9e53c810","head":{"label":"PolySat:virt-time-refactor","ref":"virt-time-refactor","sha":"94c0d7707dc37e6c7e8f0579ee4cefec9e53c810","user":{"login":"PolySat","id":18710029,"avatar_url":"https://avatars2.githubusercontent.com/u/18710029?v=4","gravatar_id":"","url":"https://api.github.com/users/PolySat","html_url":"https://github.com/PolySat","followers_url":"https://api.github.com/users/PolySat/followers","following_url":"https://api.github.com/users/PolySat/following{/other_user}","gists_url":"https://api.github.com/users/PolySat/gists{/gist_id}","starred_url":"https://api.github.com/users/PolySat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolySat/subscriptions","organizations_url":"https://api.github.com/users/PolySat/orgs","repos_url":"https://api.github.com/users/PolySat/repos","events_url":"https://api.github.com/users/PolySat/events{/privacy}","received_events_url":"https://api.github.com/users/PolySat/received_events","type":"Organization","site_admin":false},"repo":{"id":117877798,"name":"libproc","full_name":"PolySat/libproc","owner":{"login":"PolySat","id":18710029,"avatar_url":"https://avatars2.githubusercontent.com/u/18710029?v=4","gravatar_id":"","url":"https://api.github.com/users/PolySat","html_url":"https://github.com/PolySat","followers_url":"https://api.github.com/users/PolySat/followers","following_url":"https://api.github.com/users/PolySat/following{/other_user}","gists_url":"https://api.github.com/users/PolySat/gists{/gist_id}","starred_url":"https://api.github.com/users/PolySat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolySat/subscriptions","organizations_url":"https://api.github.com/users/PolySat/orgs","repos_url":"https://api.github.com/users/PolySat/repos","events_url":"https://api.github.com/users/PolySat/events{/privacy}","received_events_url":"https://api.github.com/users/PolySat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PolySat/libproc","description":"A lightweight event loop and inter-process communication library","fork":false,"url":"https://api.github.com/repos/PolySat/libproc","forks_url":"https://api.github.com/repos/PolySat/libproc/forks","keys_url":"https://api.github.com/repos/PolySat/libproc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolySat/libproc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolySat/libproc/teams","hooks_url":"https://api.github.com/repos/PolySat/libproc/hooks","issue_events_url":"https://api.github.com/repos/PolySat/libproc/issues/events{/number}","events_url":"https://api.github.com/repos/PolySat/libproc/events","assignees_url":"https://api.github.com/repos/PolySat/libproc/assignees{/user}","branches_url":"https://api.github.com/repos/PolySat/libproc/branches{/branch}","tags_url":"https://api.github.com/repos/PolySat/libproc/tags","blobs_url":"https://api.github.com/repos/PolySat/libproc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolySat/libproc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolySat/libproc/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolySat/libproc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolySat/libproc/statuses/{sha}","languages_url":"https://api.github.com/repos/PolySat/libproc/languages","stargazers_url":"https://api.github.com/repos/PolySat/libproc/stargazers","contributors_url":"https://api.github.com/repos/PolySat/libproc/contributors","subscribers_url":"https://api.github.com/repos/PolySat/libproc/subscribers","subscription_url":"https://api.github.com/repos/PolySat/libproc/subscription","commits_url":"https://api.github.com/repos/PolySat/libproc/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolySat/libproc/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolySat/libproc/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolySat/libproc/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolySat/libproc/contents/{+path}","compare_url":"https://api.github.com/repos/PolySat/libproc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolySat/libproc/merges","archive_url":"https://api.github.com/repos/PolySat/libproc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolySat/libproc/downloads","issues_url":"https://api.github.com/repos/PolySat/libproc/issues{/number}","pulls_url":"https://api.github.com/repos/PolySat/libproc/pulls{/number}","milestones_url":"https://api.github.com/repos/PolySat/libproc/milestones{/number}","notifications_url":"https://api.github.com/repos/PolySat/libproc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolySat/libproc/labels{/name}","releases_url":"https://api.github.com/repos/PolySat/libproc/releases{/id}","deployments_url":"https://api.github.com/repos/PolySat/libproc/deployments","created_at":"2018-01-17T18:46:09Z","updated_at":"2018-05-27T18:52:56Z","pushed_at":"2018-05-27T23:28:47Z","git_url":"git://github.com/PolySat/libproc.git","ssh_url":"git@github.com:PolySat/libproc.git","clone_url":"https://github.com/PolySat/libproc.git","svn_url":"https://github.com/PolySat/libproc","homepage":null,"size":132,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"PolySat:master","ref":"master","sha":"d4b6a21ceadc317f802a923f479838f4333056db","user":{"login":"PolySat","id":18710029,"avatar_url":"https://avatars2.githubusercontent.com/u/18710029?v=4","gravatar_id":"","url":"https://api.github.com/users/PolySat","html_url":"https://github.com/PolySat","followers_url":"https://api.github.com/users/PolySat/followers","following_url":"https://api.github.com/users/PolySat/following{/other_user}","gists_url":"https://api.github.com/users/PolySat/gists{/gist_id}","starred_url":"https://api.github.com/users/PolySat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolySat/subscriptions","organizations_url":"https://api.github.com/users/PolySat/orgs","repos_url":"https://api.github.com/users/PolySat/repos","events_url":"https://api.github.com/users/PolySat/events{/privacy}","received_events_url":"https://api.github.com/users/PolySat/received_events","type":"Organization","site_admin":false},"repo":{"id":117877798,"name":"libproc","full_name":"PolySat/libproc","owner":{"login":"PolySat","id":18710029,"avatar_url":"https://avatars2.githubusercontent.com/u/18710029?v=4","gravatar_id":"","url":"https://api.github.com/users/PolySat","html_url":"https://github.com/PolySat","followers_url":"https://api.github.com/users/PolySat/followers","following_url":"https://api.github.com/users/PolySat/following{/other_user}","gists_url":"https://api.github.com/users/PolySat/gists{/gist_id}","starred_url":"https://api.github.com/users/PolySat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolySat/subscriptions","organizations_url":"https://api.github.com/users/PolySat/orgs","repos_url":"https://api.github.com/users/PolySat/repos","events_url":"https://api.github.com/users/PolySat/events{/privacy}","received_events_url":"https://api.github.com/users/PolySat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PolySat/libproc","description":"A lightweight event loop and inter-process communication library","fork":false,"url":"https://api.github.com/repos/PolySat/libproc","forks_url":"https://api.github.com/repos/PolySat/libproc/forks","keys_url":"https://api.github.com/repos/PolySat/libproc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolySat/libproc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolySat/libproc/teams","hooks_url":"https://api.github.com/repos/PolySat/libproc/hooks","issue_events_url":"https://api.github.com/repos/PolySat/libproc/issues/events{/number}","events_url":"https://api.github.com/repos/PolySat/libproc/events","assignees_url":"https://api.github.com/repos/PolySat/libproc/assignees{/user}","branches_url":"https://api.github.com/repos/PolySat/libproc/branches{/branch}","tags_url":"https://api.github.com/repos/PolySat/libproc/tags","blobs_url":"https://api.github.com/repos/PolySat/libproc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolySat/libproc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolySat/libproc/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolySat/libproc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolySat/libproc/statuses/{sha}","languages_url":"https://api.github.com/repos/PolySat/libproc/languages","stargazers_url":"https://api.github.com/repos/PolySat/libproc/stargazers","contributors_url":"https://api.github.com/repos/PolySat/libproc/contributors","subscribers_url":"https://api.github.com/repos/PolySat/libproc/subscribers","subscription_url":"https://api.github.com/repos/PolySat/libproc/subscription","commits_url":"https://api.github.com/repos/PolySat/libproc/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolySat/libproc/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolySat/libproc/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolySat/libproc/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolySat/libproc/contents/{+path}","compare_url":"https://api.github.com/repos/PolySat/libproc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolySat/libproc/merges","archive_url":"https://api.github.com/repos/PolySat/libproc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolySat/libproc/downloads","issues_url":"https://api.github.com/repos/PolySat/libproc/issues{/number}","pulls_url":"https://api.github.com/repos/PolySat/libproc/pulls{/number}","milestones_url":"https://api.github.com/repos/PolySat/libproc/milestones{/number}","notifications_url":"https://api.github.com/repos/PolySat/libproc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolySat/libproc/labels{/name}","releases_url":"https://api.github.com/repos/PolySat/libproc/releases{/id}","deployments_url":"https://api.github.com/repos/PolySat/libproc/deployments","created_at":"2018-01-17T18:46:09Z","updated_at":"2018-05-27T18:52:56Z","pushed_at":"2018-05-27T23:28:47Z","git_url":"git://github.com/PolySat/libproc.git","ssh_url":"git@github.com:PolySat/libproc.git","clone_url":"https://github.com/PolySat/libproc.git","svn_url":"https://github.com/PolySat/libproc","homepage":null,"size":132,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/8"},"html":{"href":"https://github.com/PolySat/libproc/pull/8"},"issue":{"href":"https://api.github.com/repos/PolySat/libproc/issues/8"},"comments":{"href":"https://api.github.com/repos/PolySat/libproc/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PolySat/libproc/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/PolySat/libproc/statuses/94c0d7707dc37e6c7e8f0579ee4cefec9e53c810"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"johnbellardo"}}