{"action":"created","comment":{"url":"https://api.github.com/repos/kimai/kimai/pulls/comments/60832968","id":60832968,"diff_hunk":"@@ -480,8 +479,7 @@ function buzzer_preselect_update_ui(selector,selectedID,updateRecording) {\n // ... so just THX! ;)\n \n function ticktac() {\n-    startsecoffset = startsec ? startsec : offset;\n-    sek   = Math.floor((new Date()).getTime()/1000)-startsecoffset;\n+    sek   = Math.floor((new Date()).getTime()/1000) - startsec - offset;","path":"js/main.js","position":20,"original_position":20,"commit_id":"6d1c3f543ac65b80eec8930e7fcbc1b0917cffa8","original_commit_id":"6d1c3f543ac65b80eec8930e7fcbc1b0917cffa8","user":{"login":"simonschaufi","id":941794,"avatar_url":"https://avatars.githubusercontent.com/u/941794?v=3","gravatar_id":"","url":"https://api.github.com/users/simonschaufi","html_url":"https://github.com/simonschaufi","followers_url":"https://api.github.com/users/simonschaufi/followers","following_url":"https://api.github.com/users/simonschaufi/following{/other_user}","gists_url":"https://api.github.com/users/simonschaufi/gists{/gist_id}","starred_url":"https://api.github.com/users/simonschaufi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonschaufi/subscriptions","organizations_url":"https://api.github.com/users/simonschaufi/orgs","repos_url":"https://api.github.com/users/simonschaufi/repos","events_url":"https://api.github.com/users/simonschaufi/events{/privacy}","received_events_url":"https://api.github.com/users/simonschaufi/received_events","type":"User","site_admin":false},"body":"can we extract this calculation into a function? then you can use better internal variable names so that other people also understand what's going on.\r\nI would expect something like this:\r\n```\r\nsek = getTimeDiff(...)\r\n```","created_at":"2016-04-23T18:38:52Z","updated_at":"2016-04-23T18:38:52Z","html_url":"https://github.com/kimai/kimai/pull/681#discussion_r60832968","pull_request_url":"https://api.github.com/repos/kimai/kimai/pulls/681","_links":{"self":{"href":"https://api.github.com/repos/kimai/kimai/pulls/comments/60832968"},"html":{"href":"https://github.com/kimai/kimai/pull/681#discussion_r60832968"},"pull_request":{"href":"https://api.github.com/repos/kimai/kimai/pulls/681"}}},"pull_request":{"url":"https://api.github.com/repos/kimai/kimai/pulls/681","id":67557501,"html_url":"https://github.com/kimai/kimai/pull/681","diff_url":"https://github.com/kimai/kimai/pull/681.diff","patch_url":"https://github.com/kimai/kimai/pull/681.patch","issue_url":"https://api.github.com/repos/kimai/kimai/issues/681","number":681,"state":"open","locked":false,"title":"Use server time in startRecord (resolves #507), cleanup","user":{"login":"HenryNe","id":12493969,"avatar_url":"https://avatars.githubusercontent.com/u/12493969?v=3","gravatar_id":"","url":"https://api.github.com/users/HenryNe","html_url":"https://github.com/HenryNe","followers_url":"https://api.github.com/users/HenryNe/followers","following_url":"https://api.github.com/users/HenryNe/following{/other_user}","gists_url":"https://api.github.com/users/HenryNe/gists{/gist_id}","starred_url":"https://api.github.com/users/HenryNe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HenryNe/subscriptions","organizations_url":"https://api.github.com/users/HenryNe/orgs","repos_url":"https://api.github.com/users/HenryNe/repos","events_url":"https://api.github.com/users/HenryNe/events{/privacy}","received_events_url":"https://api.github.com/users/HenryNe/received_events","type":"User","site_admin":false},"body":"FIXES #507, #266, #403\r\n\r\nChanges proposed in this pull request:\r\n- Use server time in startRecord\r\n- Adjust offset for ticktac (Buzzer)\r\n- \"offset\" is timediff between server and local, only set ones on page load\r\n- \"startsec\" is server time\r\n- \"now\" is local time\r\n\r\nReason for this pull request:\r\n- Fix different time base for start and stop timer\r\n\r\nHow to test:\r\n\r\n1. Force a timediff between server and your local system. For example set your local time 1 hour in future of _same_ timezone. Set local time 14:00 CET, if the server time is 13:00 CET.\r\n2. Press start and stop in same minute ( <60 sec)\r\n3. Failed with old code recorded: In=14:00 Out=13:00 h'm=-1:00 rate=-1,00\r\n4. After this patch recorded: In=13:00 Out=13:00 h'm=0:00 rate=0,00\r\n","created_at":"2016-04-22T19:00:31Z","updated_at":"2016-04-23T18:38:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d7e7172a1c136c63763f0d36a2b90c6d97edb79","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kimai/kimai/pulls/681/commits","review_comments_url":"https://api.github.com/repos/kimai/kimai/pulls/681/comments","review_comment_url":"https://api.github.com/repos/kimai/kimai/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kimai/kimai/issues/681/comments","statuses_url":"https://api.github.com/repos/kimai/kimai/statuses/6d1c3f543ac65b80eec8930e7fcbc1b0917cffa8","head":{"label":"HenryNe:use_server_time2","ref":"use_server_time2","sha":"6d1c3f543ac65b80eec8930e7fcbc1b0917cffa8","user":{"login":"HenryNe","id":12493969,"avatar_url":"https://avatars.githubusercontent.com/u/12493969?v=3","gravatar_id":"","url":"https://api.github.com/users/HenryNe","html_url":"https://github.com/HenryNe","followers_url":"https://api.github.com/users/HenryNe/followers","following_url":"https://api.github.com/users/HenryNe/following{/other_user}","gists_url":"https://api.github.com/users/HenryNe/gists{/gist_id}","starred_url":"https://api.github.com/users/HenryNe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HenryNe/subscriptions","organizations_url":"https://api.github.com/users/HenryNe/orgs","repos_url":"https://api.github.com/users/HenryNe/repos","events_url":"https://api.github.com/users/HenryNe/events{/privacy}","received_events_url":"https://api.github.com/users/HenryNe/received_events","type":"User","site_admin":false},"repo":{"id":55836094,"name":"kimai","full_name":"HenryNe/kimai","owner":{"login":"HenryNe","id":12493969,"avatar_url":"https://avatars.githubusercontent.com/u/12493969?v=3","gravatar_id":"","url":"https://api.github.com/users/HenryNe","html_url":"https://github.com/HenryNe","followers_url":"https://api.github.com/users/HenryNe/followers","following_url":"https://api.github.com/users/HenryNe/following{/other_user}","gists_url":"https://api.github.com/users/HenryNe/gists{/gist_id}","starred_url":"https://api.github.com/users/HenryNe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HenryNe/subscriptions","organizations_url":"https://api.github.com/users/HenryNe/orgs","repos_url":"https://api.github.com/users/HenryNe/repos","events_url":"https://api.github.com/users/HenryNe/events{/privacy}","received_events_url":"https://api.github.com/users/HenryNe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HenryNe/kimai","description":"Kimai open source time tracking (fork for PHP 5.2.x)","fork":true,"url":"https://api.github.com/repos/HenryNe/kimai","forks_url":"https://api.github.com/repos/HenryNe/kimai/forks","keys_url":"https://api.github.com/repos/HenryNe/kimai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HenryNe/kimai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HenryNe/kimai/teams","hooks_url":"https://api.github.com/repos/HenryNe/kimai/hooks","issue_events_url":"https://api.github.com/repos/HenryNe/kimai/issues/events{/number}","events_url":"https://api.github.com/repos/HenryNe/kimai/events","assignees_url":"https://api.github.com/repos/HenryNe/kimai/assignees{/user}","branches_url":"https://api.github.com/repos/HenryNe/kimai/branches{/branch}","tags_url":"https://api.github.com/repos/HenryNe/kimai/tags","blobs_url":"https://api.github.com/repos/HenryNe/kimai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HenryNe/kimai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HenryNe/kimai/git/refs{/sha}","trees_url":"https://api.github.com/repos/HenryNe/kimai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HenryNe/kimai/statuses/{sha}","languages_url":"https://api.github.com/repos/HenryNe/kimai/languages","stargazers_url":"https://api.github.com/repos/HenryNe/kimai/stargazers","contributors_url":"https://api.github.com/repos/HenryNe/kimai/contributors","subscribers_url":"https://api.github.com/repos/HenryNe/kimai/subscribers","subscription_url":"https://api.github.com/repos/HenryNe/kimai/subscription","commits_url":"https://api.github.com/repos/HenryNe/kimai/commits{/sha}","git_commits_url":"https://api.github.com/repos/HenryNe/kimai/git/commits{/sha}","comments_url":"https://api.github.com/repos/HenryNe/kimai/comments{/number}","issue_comment_url":"https://api.github.com/repos/HenryNe/kimai/issues/comments{/number}","contents_url":"https://api.github.com/repos/HenryNe/kimai/contents/{+path}","compare_url":"https://api.github.com/repos/HenryNe/kimai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HenryNe/kimai/merges","archive_url":"https://api.github.com/repos/HenryNe/kimai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HenryNe/kimai/downloads","issues_url":"https://api.github.com/repos/HenryNe/kimai/issues{/number}","pulls_url":"https://api.github.com/repos/HenryNe/kimai/pulls{/number}","milestones_url":"https://api.github.com/repos/HenryNe/kimai/milestones{/number}","notifications_url":"https://api.github.com/repos/HenryNe/kimai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HenryNe/kimai/labels{/name}","releases_url":"https://api.github.com/repos/HenryNe/kimai/releases{/id}","deployments_url":"https://api.github.com/repos/HenryNe/kimai/deployments","created_at":"2016-04-09T09:26:07Z","updated_at":"2016-04-09T11:45:28Z","pushed_at":"2016-04-23T18:35:33Z","git_url":"git://github.com/HenryNe/kimai.git","ssh_url":"git@github.com:HenryNe/kimai.git","clone_url":"https://github.com/HenryNe/kimai.git","svn_url":"https://github.com/HenryNe/kimai","homepage":"http://www.kimai.org","size":58315,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"kimai:develop","ref":"develop","sha":"443ce9d39655e9d04cae0f2832429923a4faa80d","user":{"login":"kimai","id":981996,"avatar_url":"https://avatars.githubusercontent.com/u/981996?v=3","gravatar_id":"","url":"https://api.github.com/users/kimai","html_url":"https://github.com/kimai","followers_url":"https://api.github.com/users/kimai/followers","following_url":"https://api.github.com/users/kimai/following{/other_user}","gists_url":"https://api.github.com/users/kimai/gists{/gist_id}","starred_url":"https://api.github.com/users/kimai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimai/subscriptions","organizations_url":"https://api.github.com/users/kimai/orgs","repos_url":"https://api.github.com/users/kimai/repos","events_url":"https://api.github.com/users/kimai/events{/privacy}","received_events_url":"https://api.github.com/users/kimai/received_events","type":"Organization","site_admin":false},"repo":{"id":2212377,"name":"kimai","full_name":"kimai/kimai","owner":{"login":"kimai","id":981996,"avatar_url":"https://avatars.githubusercontent.com/u/981996?v=3","gravatar_id":"","url":"https://api.github.com/users/kimai","html_url":"https://github.com/kimai","followers_url":"https://api.github.com/users/kimai/followers","following_url":"https://api.github.com/users/kimai/following{/other_user}","gists_url":"https://api.github.com/users/kimai/gists{/gist_id}","starred_url":"https://api.github.com/users/kimai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimai/subscriptions","organizations_url":"https://api.github.com/users/kimai/orgs","repos_url":"https://api.github.com/users/kimai/repos","events_url":"https://api.github.com/users/kimai/events{/privacy}","received_events_url":"https://api.github.com/users/kimai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kimai/kimai","description":"Kimai open source time tracking","fork":false,"url":"https://api.github.com/repos/kimai/kimai","forks_url":"https://api.github.com/repos/kimai/kimai/forks","keys_url":"https://api.github.com/repos/kimai/kimai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kimai/kimai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kimai/kimai/teams","hooks_url":"https://api.github.com/repos/kimai/kimai/hooks","issue_events_url":"https://api.github.com/repos/kimai/kimai/issues/events{/number}","events_url":"https://api.github.com/repos/kimai/kimai/events","assignees_url":"https://api.github.com/repos/kimai/kimai/assignees{/user}","branches_url":"https://api.github.com/repos/kimai/kimai/branches{/branch}","tags_url":"https://api.github.com/repos/kimai/kimai/tags","blobs_url":"https://api.github.com/repos/kimai/kimai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kimai/kimai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kimai/kimai/git/refs{/sha}","trees_url":"https://api.github.com/repos/kimai/kimai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kimai/kimai/statuses/{sha}","languages_url":"https://api.github.com/repos/kimai/kimai/languages","stargazers_url":"https://api.github.com/repos/kimai/kimai/stargazers","contributors_url":"https://api.github.com/repos/kimai/kimai/contributors","subscribers_url":"https://api.github.com/repos/kimai/kimai/subscribers","subscription_url":"https://api.github.com/repos/kimai/kimai/subscription","commits_url":"https://api.github.com/repos/kimai/kimai/commits{/sha}","git_commits_url":"https://api.github.com/repos/kimai/kimai/git/commits{/sha}","comments_url":"https://api.github.com/repos/kimai/kimai/comments{/number}","issue_comment_url":"https://api.github.com/repos/kimai/kimai/issues/comments{/number}","contents_url":"https://api.github.com/repos/kimai/kimai/contents/{+path}","compare_url":"https://api.github.com/repos/kimai/kimai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kimai/kimai/merges","archive_url":"https://api.github.com/repos/kimai/kimai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kimai/kimai/downloads","issues_url":"https://api.github.com/repos/kimai/kimai/issues{/number}","pulls_url":"https://api.github.com/repos/kimai/kimai/pulls{/number}","milestones_url":"https://api.github.com/repos/kimai/kimai/milestones{/number}","notifications_url":"https://api.github.com/repos/kimai/kimai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kimai/kimai/labels{/name}","releases_url":"https://api.github.com/repos/kimai/kimai/releases{/id}","deployments_url":"https://api.github.com/repos/kimai/kimai/deployments","created_at":"2011-08-15T21:27:11Z","updated_at":"2016-04-22T11:27:54Z","pushed_at":"2016-04-23T18:35:35Z","git_url":"git://github.com/kimai/kimai.git","ssh_url":"git@github.com:kimai/kimai.git","clone_url":"https://github.com/kimai/kimai.git","svn_url":"https://github.com/kimai/kimai","homepage":"http://www.kimai.org","size":60673,"stargazers_count":260,"watchers_count":260,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":161,"mirror_url":null,"open_issues_count":82,"forks":161,"open_issues":82,"watchers":260,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kimai/kimai/pulls/681"},"html":{"href":"https://github.com/kimai/kimai/pull/681"},"issue":{"href":"https://api.github.com/repos/kimai/kimai/issues/681"},"comments":{"href":"https://api.github.com/repos/kimai/kimai/issues/681/comments"},"review_comments":{"href":"https://api.github.com/repos/kimai/kimai/pulls/681/comments"},"review_comment":{"href":"https://api.github.com/repos/kimai/kimai/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kimai/kimai/pulls/681/commits"},"statuses":{"href":"https://api.github.com/repos/kimai/kimai/statuses/6d1c3f543ac65b80eec8930e7fcbc1b0917cffa8"}}}}