{"action":"created","comment":{"url":"https://api.github.com/repos/robotika/osgar/pulls/comments/146113689","pull_request_review_id":71015448,"id":146113689,"diff_hunk":"@@ -130,16 +133,30 @@ def stopLaser( self ):\n   def configureScanDataOutput( self ):\n     pass\n \n+\n+def write_timestamp(f):\n+  \"\"\"write time.time() in sec/frac into a binary file\"\"\"\n+  t = time.time()\n+  sec = int(t)\n+  frac = int(0x10000*(t-sec))\n+  f.write(struct.pack('IH', sec, frac))","path":"laser.py","position":20,"original_position":20,"commit_id":"ac58af6dbf7cb0e5f6e5b28ce5947370f750552a","original_commit_id":"ac58af6dbf7cb0e5f6e5b28ce5947370f750552a","user":{"login":"zwn","id":1130051,"avatar_url":"https://avatars3.githubusercontent.com/u/1130051?v=4","gravatar_id":"","url":"https://api.github.com/users/zwn","html_url":"https://github.com/zwn","followers_url":"https://api.github.com/users/zwn/followers","following_url":"https://api.github.com/users/zwn/following{/other_user}","gists_url":"https://api.github.com/users/zwn/gists{/gist_id}","starred_url":"https://api.github.com/users/zwn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwn/subscriptions","organizations_url":"https://api.github.com/users/zwn/orgs","repos_url":"https://api.github.com/users/zwn/repos","events_url":"https://api.github.com/users/zwn/events{/privacy}","received_events_url":"https://api.github.com/users/zwn/received_events","type":"User","site_admin":false},"body":"I don't really care that much about the number of bytes used. What I really don't like is, that you start with float, convert it to int, write it to log, read it and convert it back to float.\r\n\r\nAs for the sizes:\r\n* 'IH' is 6 bytes - epoch starts at 1970\r\n* [NTP uses 64bit](https://en.wikipedia.org/wiki/Network_Time_Protocol#Timestamps) - epoch starts at 1900\r\n* Python [timedelta uses (days, seconds, micro)](https://docs.python.org/2/library/datetime.html?highlight=timedelta#datetime.timedelta) - you can pick your epoch - I'd pick the start of the log\r\n\r\nTo summarize: \r\n* I'd use timedelta for all calculations in the program\r\n* I'd let you pick what's written in the log (but why not use NTP timestamps?)\r\n* I'd log the absolute time of the start of the log at the start of the log (the absolute time is usually not needed for anything so this is \"just in case\")\r\n","created_at":"2017-10-21T19:32:47Z","updated_at":"2017-10-21T19:32:47Z","html_url":"https://github.com/robotika/osgar/pull/34#discussion_r146113689","pull_request_url":"https://api.github.com/repos/robotika/osgar/pulls/34","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/robotika/osgar/pulls/comments/146113689"},"html":{"href":"https://github.com/robotika/osgar/pull/34#discussion_r146113689"},"pull_request":{"href":"https://api.github.com/repos/robotika/osgar/pulls/34"}},"in_reply_to_id":146102155},"pull_request":{"url":"https://api.github.com/repos/robotika/osgar/pulls/34","id":147932361,"html_url":"https://github.com/robotika/osgar/pull/34","diff_url":"https://github.com/robotika/osgar/pull/34.diff","patch_url":"https://github.com/robotika/osgar/pull/34.patch","issue_url":"https://api.github.com/repos/robotika/osgar/issues/34","number":34,"state":"open","locked":false,"title":"Logging of raw laser data + fixup for turning off in navpat","user":{"login":"m3d","id":5664353,"avatar_url":"https://avatars0.githubusercontent.com/u/5664353?v=4","gravatar_id":"","url":"https://api.github.com/users/m3d","html_url":"https://github.com/m3d","followers_url":"https://api.github.com/users/m3d/followers","following_url":"https://api.github.com/users/m3d/following{/other_user}","gists_url":"https://api.github.com/users/m3d/gists{/gist_id}","starred_url":"https://api.github.com/users/m3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3d/subscriptions","organizations_url":"https://api.github.com/users/m3d/orgs","repos_url":"https://api.github.com/users/m3d/repos","events_url":"https://api.github.com/users/m3d/events{/privacy}","received_events_url":"https://api.github.com/users/m3d/received_events","type":"User","site_admin":false},"body":"This is the second pull request from recent feature/testYYMMDD related to laser logging and debugging issue with 20s gaps. They were caused by previously turned off laser, but detailed logging of communication could be useful also in the future (and now I would need it also for Velodyne, so some kind of reuse is expected).","created_at":"2017-10-21T07:17:13Z","updated_at":"2017-10-21T19:32:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb4795cd35e5194811182e09360c2e9a3ba53d69","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/robotika/osgar/pulls/34/commits","review_comments_url":"https://api.github.com/repos/robotika/osgar/pulls/34/comments","review_comment_url":"https://api.github.com/repos/robotika/osgar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/robotika/osgar/issues/34/comments","statuses_url":"https://api.github.com/repos/robotika/osgar/statuses/ac58af6dbf7cb0e5f6e5b28ce5947370f750552a","head":{"label":"robotika:feature/laserraw","ref":"feature/laserraw","sha":"ac58af6dbf7cb0e5f6e5b28ce5947370f750552a","user":{"login":"robotika","id":5670473,"avatar_url":"https://avatars0.githubusercontent.com/u/5670473?v=4","gravatar_id":"","url":"https://api.github.com/users/robotika","html_url":"https://github.com/robotika","followers_url":"https://api.github.com/users/robotika/followers","following_url":"https://api.github.com/users/robotika/following{/other_user}","gists_url":"https://api.github.com/users/robotika/gists{/gist_id}","starred_url":"https://api.github.com/users/robotika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotika/subscriptions","organizations_url":"https://api.github.com/users/robotika/orgs","repos_url":"https://api.github.com/users/robotika/repos","events_url":"https://api.github.com/users/robotika/events{/privacy}","received_events_url":"https://api.github.com/users/robotika/received_events","type":"Organization","site_admin":false},"repo":{"id":20634831,"name":"osgar","full_name":"robotika/osgar","owner":{"login":"robotika","id":5670473,"avatar_url":"https://avatars0.githubusercontent.com/u/5670473?v=4","gravatar_id":"","url":"https://api.github.com/users/robotika","html_url":"https://github.com/robotika","followers_url":"https://api.github.com/users/robotika/followers","following_url":"https://api.github.com/users/robotika/following{/other_user}","gists_url":"https://api.github.com/users/robotika/gists{/gist_id}","starred_url":"https://api.github.com/users/robotika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotika/subscriptions","organizations_url":"https://api.github.com/users/robotika/orgs","repos_url":"https://api.github.com/users/robotika/repos","events_url":"https://api.github.com/users/robotika/events{/privacy}","received_events_url":"https://api.github.com/users/robotika/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/robotika/osgar","description":"Open Source Garden (Autonomous) Robot","fork":false,"url":"https://api.github.com/repos/robotika/osgar","forks_url":"https://api.github.com/repos/robotika/osgar/forks","keys_url":"https://api.github.com/repos/robotika/osgar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robotika/osgar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robotika/osgar/teams","hooks_url":"https://api.github.com/repos/robotika/osgar/hooks","issue_events_url":"https://api.github.com/repos/robotika/osgar/issues/events{/number}","events_url":"https://api.github.com/repos/robotika/osgar/events","assignees_url":"https://api.github.com/repos/robotika/osgar/assignees{/user}","branches_url":"https://api.github.com/repos/robotika/osgar/branches{/branch}","tags_url":"https://api.github.com/repos/robotika/osgar/tags","blobs_url":"https://api.github.com/repos/robotika/osgar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robotika/osgar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robotika/osgar/git/refs{/sha}","trees_url":"https://api.github.com/repos/robotika/osgar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robotika/osgar/statuses/{sha}","languages_url":"https://api.github.com/repos/robotika/osgar/languages","stargazers_url":"https://api.github.com/repos/robotika/osgar/stargazers","contributors_url":"https://api.github.com/repos/robotika/osgar/contributors","subscribers_url":"https://api.github.com/repos/robotika/osgar/subscribers","subscription_url":"https://api.github.com/repos/robotika/osgar/subscription","commits_url":"https://api.github.com/repos/robotika/osgar/commits{/sha}","git_commits_url":"https://api.github.com/repos/robotika/osgar/git/commits{/sha}","comments_url":"https://api.github.com/repos/robotika/osgar/comments{/number}","issue_comment_url":"https://api.github.com/repos/robotika/osgar/issues/comments{/number}","contents_url":"https://api.github.com/repos/robotika/osgar/contents/{+path}","compare_url":"https://api.github.com/repos/robotika/osgar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robotika/osgar/merges","archive_url":"https://api.github.com/repos/robotika/osgar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robotika/osgar/downloads","issues_url":"https://api.github.com/repos/robotika/osgar/issues{/number}","pulls_url":"https://api.github.com/repos/robotika/osgar/pulls{/number}","milestones_url":"https://api.github.com/repos/robotika/osgar/milestones{/number}","notifications_url":"https://api.github.com/repos/robotika/osgar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robotika/osgar/labels{/name}","releases_url":"https://api.github.com/repos/robotika/osgar/releases{/id}","deployments_url":"https://api.github.com/repos/robotika/osgar/deployments","created_at":"2014-06-09T04:54:03Z","updated_at":"2017-02-16T10:22:59Z","pushed_at":"2017-10-21T16:54:32Z","git_url":"git://github.com/robotika/osgar.git","ssh_url":"git@github.com:robotika/osgar.git","clone_url":"https://github.com/robotika/osgar.git","svn_url":"https://github.com/robotika/osgar","homepage":null,"size":249,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":1,"default_branch":"master"}},"base":{"label":"robotika:master","ref":"master","sha":"ddbd38eefc60918f8a3d19fd64467cc6b8439618","user":{"login":"robotika","id":5670473,"avatar_url":"https://avatars0.githubusercontent.com/u/5670473?v=4","gravatar_id":"","url":"https://api.github.com/users/robotika","html_url":"https://github.com/robotika","followers_url":"https://api.github.com/users/robotika/followers","following_url":"https://api.github.com/users/robotika/following{/other_user}","gists_url":"https://api.github.com/users/robotika/gists{/gist_id}","starred_url":"https://api.github.com/users/robotika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotika/subscriptions","organizations_url":"https://api.github.com/users/robotika/orgs","repos_url":"https://api.github.com/users/robotika/repos","events_url":"https://api.github.com/users/robotika/events{/privacy}","received_events_url":"https://api.github.com/users/robotika/received_events","type":"Organization","site_admin":false},"repo":{"id":20634831,"name":"osgar","full_name":"robotika/osgar","owner":{"login":"robotika","id":5670473,"avatar_url":"https://avatars0.githubusercontent.com/u/5670473?v=4","gravatar_id":"","url":"https://api.github.com/users/robotika","html_url":"https://github.com/robotika","followers_url":"https://api.github.com/users/robotika/followers","following_url":"https://api.github.com/users/robotika/following{/other_user}","gists_url":"https://api.github.com/users/robotika/gists{/gist_id}","starred_url":"https://api.github.com/users/robotika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotika/subscriptions","organizations_url":"https://api.github.com/users/robotika/orgs","repos_url":"https://api.github.com/users/robotika/repos","events_url":"https://api.github.com/users/robotika/events{/privacy}","received_events_url":"https://api.github.com/users/robotika/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/robotika/osgar","description":"Open Source Garden (Autonomous) Robot","fork":false,"url":"https://api.github.com/repos/robotika/osgar","forks_url":"https://api.github.com/repos/robotika/osgar/forks","keys_url":"https://api.github.com/repos/robotika/osgar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robotika/osgar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robotika/osgar/teams","hooks_url":"https://api.github.com/repos/robotika/osgar/hooks","issue_events_url":"https://api.github.com/repos/robotika/osgar/issues/events{/number}","events_url":"https://api.github.com/repos/robotika/osgar/events","assignees_url":"https://api.github.com/repos/robotika/osgar/assignees{/user}","branches_url":"https://api.github.com/repos/robotika/osgar/branches{/branch}","tags_url":"https://api.github.com/repos/robotika/osgar/tags","blobs_url":"https://api.github.com/repos/robotika/osgar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robotika/osgar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robotika/osgar/git/refs{/sha}","trees_url":"https://api.github.com/repos/robotika/osgar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robotika/osgar/statuses/{sha}","languages_url":"https://api.github.com/repos/robotika/osgar/languages","stargazers_url":"https://api.github.com/repos/robotika/osgar/stargazers","contributors_url":"https://api.github.com/repos/robotika/osgar/contributors","subscribers_url":"https://api.github.com/repos/robotika/osgar/subscribers","subscription_url":"https://api.github.com/repos/robotika/osgar/subscription","commits_url":"https://api.github.com/repos/robotika/osgar/commits{/sha}","git_commits_url":"https://api.github.com/repos/robotika/osgar/git/commits{/sha}","comments_url":"https://api.github.com/repos/robotika/osgar/comments{/number}","issue_comment_url":"https://api.github.com/repos/robotika/osgar/issues/comments{/number}","contents_url":"https://api.github.com/repos/robotika/osgar/contents/{+path}","compare_url":"https://api.github.com/repos/robotika/osgar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robotika/osgar/merges","archive_url":"https://api.github.com/repos/robotika/osgar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robotika/osgar/downloads","issues_url":"https://api.github.com/repos/robotika/osgar/issues{/number}","pulls_url":"https://api.github.com/repos/robotika/osgar/pulls{/number}","milestones_url":"https://api.github.com/repos/robotika/osgar/milestones{/number}","notifications_url":"https://api.github.com/repos/robotika/osgar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robotika/osgar/labels{/name}","releases_url":"https://api.github.com/repos/robotika/osgar/releases{/id}","deployments_url":"https://api.github.com/repos/robotika/osgar/deployments","created_at":"2014-06-09T04:54:03Z","updated_at":"2017-02-16T10:22:59Z","pushed_at":"2017-10-21T16:54:32Z","git_url":"git://github.com/robotika/osgar.git","ssh_url":"git@github.com:robotika/osgar.git","clone_url":"https://github.com/robotika/osgar.git","svn_url":"https://github.com/robotika/osgar","homepage":null,"size":249,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/robotika/osgar/pulls/34"},"html":{"href":"https://github.com/robotika/osgar/pull/34"},"issue":{"href":"https://api.github.com/repos/robotika/osgar/issues/34"},"comments":{"href":"https://api.github.com/repos/robotika/osgar/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/robotika/osgar/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/robotika/osgar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/robotika/osgar/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/robotika/osgar/statuses/ac58af6dbf7cb0e5f6e5b28ce5947370f750552a"}},"author_association":"OWNER"}}
{"actor":{"display_login":"zwn"}}