{"action":"created","comment":{"url":"https://api.github.com/repos/nim-lang/Nim/pulls/comments/207578319","pull_request_review_id":143223638,"id":207578319,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzU3ODMxOQ==","diff_hunk":"@@ -943,31 +995,32 @@ else:\n     # as a result of offset changes (normally due to dst)\n     let utcUnix = adjTime.seconds + utcOffset\n     let (finalOffset, dst) = getLocalOffsetAndDst(utcUnix)\n-    result.adjTime = initTime(utcUnix - finalOffset, adjTime.nanosecond)\n+    result.time = initTime(utcUnix, adjTime.nanosecond)\n     result.utcOffset = finalOffset\n     result.isDst = dst\n \n-proc utcZoneInfoFromUtc(time: Time): ZonedTime =\n-  result.adjTime = time\n-  result.utcOffset = 0\n-  result.isDst = false\n+proc utcTzInfo(time: Time): ZonedTime =\n+  ZonedTime(utcOffset: 0, isDst: false, time: time)\n \n-proc utcZoneInfoFromTz(adjTime: Time): ZonedTime =\n-  utcZoneInfoFromUtc(adjTime) # adjTime == time since we are in UTC\n+var utcInstance = newTimezone(\"Etc/UTC\", utcTzInfo, utcTzInfo)\n+var localInstance = newTimezone(\"LOCAL\",\n+  localZonedTimeFromTime, localZonedTimeFromAdjTime)\n \n proc utc*(): TimeZone =\n   ## Get the ``Timezone`` implementation for the UTC timezone.\n   runnableExamples:\n     doAssert now().utc.timezone == utc()\n     doAssert utc().name == \"Etc/UTC\"\n-  Timezone(zoneInfoFromUtc: utcZoneInfoFromUtc, zoneInfoFromTz: utcZoneInfoFromTz, name: \"Etc/UTC\")\n+  {.gcsafe.}:\n+    result = utcInstance","path":"lib/pure/times.nim","position":259,"original_position":259,"commit_id":"eb67b5048073c3b2e4275f3d464ff8d293b4a16b","original_commit_id":"eb67b5048073c3b2e4275f3d464ff8d293b4a16b","user":{"login":"GULPF","id":1022431,"node_id":"MDQ6VXNlcjEwMjI0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/1022431?v=4","gravatar_id":"","url":"https://api.github.com/users/GULPF","html_url":"https://github.com/GULPF","followers_url":"https://api.github.com/users/GULPF/followers","following_url":"https://api.github.com/users/GULPF/following{/other_user}","gists_url":"https://api.github.com/users/GULPF/gists{/gist_id}","starred_url":"https://api.github.com/users/GULPF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GULPF/subscriptions","organizations_url":"https://api.github.com/users/GULPF/orgs","repos_url":"https://api.github.com/users/GULPF/repos","events_url":"https://api.github.com/users/GULPF/events{/privacy}","received_events_url":"https://api.github.com/users/GULPF/received_events","type":"User","site_admin":false},"body":"Is this safe since `utcInstance` will never be deallocated or mutated? I could use `{.threadvar.}` instead but if this is safe I think it's better.","created_at":"2018-08-03T15:16:01Z","updated_at":"2018-08-03T15:16:01Z","html_url":"https://github.com/nim-lang/Nim/pull/8527#discussion_r207578319","pull_request_url":"https://api.github.com/repos/nim-lang/Nim/pulls/8527","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/comments/207578319"},"html":{"href":"https://github.com/nim-lang/Nim/pull/8527#discussion_r207578319"},"pull_request":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/8527"}}},"pull_request":{"url":"https://api.github.com/repos/nim-lang/Nim/pulls/8527","id":206060800,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2MDYwODAw","html_url":"https://github.com/nim-lang/Nim/pull/8527","diff_url":"https://github.com/nim-lang/Nim/pull/8527.diff","patch_url":"https://github.com/nim-lang/Nim/pull/8527.patch","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/8527","number":8527,"state":"open","locked":false,"title":"times.Timezone changes","user":{"login":"GULPF","id":1022431,"node_id":"MDQ6VXNlcjEwMjI0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/1022431?v=4","gravatar_id":"","url":"https://api.github.com/users/GULPF","html_url":"https://github.com/GULPF","followers_url":"https://api.github.com/users/GULPF/followers","following_url":"https://api.github.com/users/GULPF/following{/other_user}","gists_url":"https://api.github.com/users/GULPF/gists{/gist_id}","starred_url":"https://api.github.com/users/GULPF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GULPF/subscriptions","organizations_url":"https://api.github.com/users/GULPF/orgs","repos_url":"https://api.github.com/users/GULPF/repos","events_url":"https://api.github.com/users/GULPF/events{/privacy}","received_events_url":"https://api.github.com/users/GULPF/received_events","type":"User","site_admin":false},"body":"This PR makes some changes to the `times.Timezone`/`times.ZonedTime` types:\r\n- `times.Timezone` is now a `ref` type.\r\n- `times.Timezone` is now immutable. Initialization is done with an explicit constructor: `newTimezone`.\r\n- Subsequent calls to `utc()` and `local()` returns the same instance, avoiding additional allocations.\r\n- Changed `times.ZonedTime` to store the `Time` instead of the adjusted `Time`.\r\n\r\nI also made some small correction in doc comments, and started using `math.floorDiv` instead of inlining the logic.\r\n\r\n### Motivation\r\nTimezones are currently copied to every `DateTime` object, which is wasteful and bloats the `DateTime` type. The old implementation also caused a string allocation every time `utc()` or `local()` was called. This new implementation will hopefully make more sense.\r\n\r\n### Breaking changes\r\nThe changes in the PR are breaking changes, but it won't break any typical usage of the times module. It only breaks code that deals with the `Timezone` type directly (e.g by creating timezones other than UTC/local), which should be very rare.\r\n","created_at":"2018-08-03T15:14:22Z","updated_at":"2018-08-03T15:16:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6cbad165e404e2aa70806e6f2a4fc671208c9697","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nim-lang/Nim/pulls/8527/commits","review_comments_url":"https://api.github.com/repos/nim-lang/Nim/pulls/8527/comments","review_comment_url":"https://api.github.com/repos/nim-lang/Nim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/8527/comments","statuses_url":"https://api.github.com/repos/nim-lang/Nim/statuses/eb67b5048073c3b2e4275f3d464ff8d293b4a16b","head":{"label":"GULPF:timezone-redesign","ref":"timezone-redesign","sha":"eb67b5048073c3b2e4275f3d464ff8d293b4a16b","user":{"login":"GULPF","id":1022431,"node_id":"MDQ6VXNlcjEwMjI0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/1022431?v=4","gravatar_id":"","url":"https://api.github.com/users/GULPF","html_url":"https://github.com/GULPF","followers_url":"https://api.github.com/users/GULPF/followers","following_url":"https://api.github.com/users/GULPF/following{/other_user}","gists_url":"https://api.github.com/users/GULPF/gists{/gist_id}","starred_url":"https://api.github.com/users/GULPF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GULPF/subscriptions","organizations_url":"https://api.github.com/users/GULPF/orgs","repos_url":"https://api.github.com/users/GULPF/repos","events_url":"https://api.github.com/users/GULPF/events{/privacy}","received_events_url":"https://api.github.com/users/GULPF/received_events","type":"User","site_admin":false},"repo":{"id":98756142,"node_id":"MDEwOlJlcG9zaXRvcnk5ODc1NjE0Mg==","name":"Nim","full_name":"GULPF/Nim","owner":{"login":"GULPF","id":1022431,"node_id":"MDQ6VXNlcjEwMjI0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/1022431?v=4","gravatar_id":"","url":"https://api.github.com/users/GULPF","html_url":"https://github.com/GULPF","followers_url":"https://api.github.com/users/GULPF/followers","following_url":"https://api.github.com/users/GULPF/following{/other_user}","gists_url":"https://api.github.com/users/GULPF/gists{/gist_id}","starred_url":"https://api.github.com/users/GULPF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GULPF/subscriptions","organizations_url":"https://api.github.com/users/GULPF/orgs","repos_url":"https://api.github.com/users/GULPF/repos","events_url":"https://api.github.com/users/GULPF/events{/privacy}","received_events_url":"https://api.github.com/users/GULPF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GULPF/Nim","description":"Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in the order of priority).","fork":true,"url":"https://api.github.com/repos/GULPF/Nim","forks_url":"https://api.github.com/repos/GULPF/Nim/forks","keys_url":"https://api.github.com/repos/GULPF/Nim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GULPF/Nim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GULPF/Nim/teams","hooks_url":"https://api.github.com/repos/GULPF/Nim/hooks","issue_events_url":"https://api.github.com/repos/GULPF/Nim/issues/events{/number}","events_url":"https://api.github.com/repos/GULPF/Nim/events","assignees_url":"https://api.github.com/repos/GULPF/Nim/assignees{/user}","branches_url":"https://api.github.com/repos/GULPF/Nim/branches{/branch}","tags_url":"https://api.github.com/repos/GULPF/Nim/tags","blobs_url":"https://api.github.com/repos/GULPF/Nim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GULPF/Nim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GULPF/Nim/git/refs{/sha}","trees_url":"https://api.github.com/repos/GULPF/Nim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GULPF/Nim/statuses/{sha}","languages_url":"https://api.github.com/repos/GULPF/Nim/languages","stargazers_url":"https://api.github.com/repos/GULPF/Nim/stargazers","contributors_url":"https://api.github.com/repos/GULPF/Nim/contributors","subscribers_url":"https://api.github.com/repos/GULPF/Nim/subscribers","subscription_url":"https://api.github.com/repos/GULPF/Nim/subscription","commits_url":"https://api.github.com/repos/GULPF/Nim/commits{/sha}","git_commits_url":"https://api.github.com/repos/GULPF/Nim/git/commits{/sha}","comments_url":"https://api.github.com/repos/GULPF/Nim/comments{/number}","issue_comment_url":"https://api.github.com/repos/GULPF/Nim/issues/comments{/number}","contents_url":"https://api.github.com/repos/GULPF/Nim/contents/{+path}","compare_url":"https://api.github.com/repos/GULPF/Nim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GULPF/Nim/merges","archive_url":"https://api.github.com/repos/GULPF/Nim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GULPF/Nim/downloads","issues_url":"https://api.github.com/repos/GULPF/Nim/issues{/number}","pulls_url":"https://api.github.com/repos/GULPF/Nim/pulls{/number}","milestones_url":"https://api.github.com/repos/GULPF/Nim/milestones{/number}","notifications_url":"https://api.github.com/repos/GULPF/Nim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GULPF/Nim/labels{/name}","releases_url":"https://api.github.com/repos/GULPF/Nim/releases{/id}","deployments_url":"https://api.github.com/repos/GULPF/Nim/deployments","created_at":"2017-07-29T20:05:42Z","updated_at":"2017-07-29T20:05:48Z","pushed_at":"2018-08-03T15:09:26Z","git_url":"git://github.com/GULPF/Nim.git","ssh_url":"git@github.com:GULPF/Nim.git","clone_url":"https://github.com/GULPF/Nim.git","svn_url":"https://github.com/GULPF/Nim","homepage":"http://nim-lang.org/","size":69549,"stargazers_count":0,"watchers_count":0,"language":"Nim","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":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"nim-lang:devel","ref":"devel","sha":"9a390d66fb86eb68851000738be5744bea1261a0","user":{"login":"nim-lang","id":603863,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMzg2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/603863?v=4","gravatar_id":"","url":"https://api.github.com/users/nim-lang","html_url":"https://github.com/nim-lang","followers_url":"https://api.github.com/users/nim-lang/followers","following_url":"https://api.github.com/users/nim-lang/following{/other_user}","gists_url":"https://api.github.com/users/nim-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/nim-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nim-lang/subscriptions","organizations_url":"https://api.github.com/users/nim-lang/orgs","repos_url":"https://api.github.com/users/nim-lang/repos","events_url":"https://api.github.com/users/nim-lang/events{/privacy}","received_events_url":"https://api.github.com/users/nim-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":842037,"node_id":"MDEwOlJlcG9zaXRvcnk4NDIwMzc=","name":"Nim","full_name":"nim-lang/Nim","owner":{"login":"nim-lang","id":603863,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMzg2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/603863?v=4","gravatar_id":"","url":"https://api.github.com/users/nim-lang","html_url":"https://github.com/nim-lang","followers_url":"https://api.github.com/users/nim-lang/followers","following_url":"https://api.github.com/users/nim-lang/following{/other_user}","gists_url":"https://api.github.com/users/nim-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/nim-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nim-lang/subscriptions","organizations_url":"https://api.github.com/users/nim-lang/orgs","repos_url":"https://api.github.com/users/nim-lang/repos","events_url":"https://api.github.com/users/nim-lang/events{/privacy}","received_events_url":"https://api.github.com/users/nim-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nim-lang/Nim","description":"Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).","fork":false,"url":"https://api.github.com/repos/nim-lang/Nim","forks_url":"https://api.github.com/repos/nim-lang/Nim/forks","keys_url":"https://api.github.com/repos/nim-lang/Nim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nim-lang/Nim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nim-lang/Nim/teams","hooks_url":"https://api.github.com/repos/nim-lang/Nim/hooks","issue_events_url":"https://api.github.com/repos/nim-lang/Nim/issues/events{/number}","events_url":"https://api.github.com/repos/nim-lang/Nim/events","assignees_url":"https://api.github.com/repos/nim-lang/Nim/assignees{/user}","branches_url":"https://api.github.com/repos/nim-lang/Nim/branches{/branch}","tags_url":"https://api.github.com/repos/nim-lang/Nim/tags","blobs_url":"https://api.github.com/repos/nim-lang/Nim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nim-lang/Nim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nim-lang/Nim/git/refs{/sha}","trees_url":"https://api.github.com/repos/nim-lang/Nim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nim-lang/Nim/statuses/{sha}","languages_url":"https://api.github.com/repos/nim-lang/Nim/languages","stargazers_url":"https://api.github.com/repos/nim-lang/Nim/stargazers","contributors_url":"https://api.github.com/repos/nim-lang/Nim/contributors","subscribers_url":"https://api.github.com/repos/nim-lang/Nim/subscribers","subscription_url":"https://api.github.com/repos/nim-lang/Nim/subscription","commits_url":"https://api.github.com/repos/nim-lang/Nim/commits{/sha}","git_commits_url":"https://api.github.com/repos/nim-lang/Nim/git/commits{/sha}","comments_url":"https://api.github.com/repos/nim-lang/Nim/comments{/number}","issue_comment_url":"https://api.github.com/repos/nim-lang/Nim/issues/comments{/number}","contents_url":"https://api.github.com/repos/nim-lang/Nim/contents/{+path}","compare_url":"https://api.github.com/repos/nim-lang/Nim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nim-lang/Nim/merges","archive_url":"https://api.github.com/repos/nim-lang/Nim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nim-lang/Nim/downloads","issues_url":"https://api.github.com/repos/nim-lang/Nim/issues{/number}","pulls_url":"https://api.github.com/repos/nim-lang/Nim/pulls{/number}","milestones_url":"https://api.github.com/repos/nim-lang/Nim/milestones{/number}","notifications_url":"https://api.github.com/repos/nim-lang/Nim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nim-lang/Nim/labels{/name}","releases_url":"https://api.github.com/repos/nim-lang/Nim/releases{/id}","deployments_url":"https://api.github.com/repos/nim-lang/Nim/deployments","created_at":"2010-08-16T20:38:58Z","updated_at":"2018-08-03T11:13:12Z","pushed_at":"2018-08-03T15:14:23Z","git_url":"git://github.com/nim-lang/Nim.git","ssh_url":"git@github.com:nim-lang/Nim.git","clone_url":"https://github.com/nim-lang/Nim.git","svn_url":"https://github.com/nim-lang/Nim","homepage":"https://nim-lang.org/","size":69732,"stargazers_count":5252,"watchers_count":5252,"language":"Nim","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":683,"mirror_url":null,"archived":false,"open_issues_count":1509,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":683,"open_issues":1509,"watchers":5252,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/8527"},"html":{"href":"https://github.com/nim-lang/Nim/pull/8527"},"issue":{"href":"https://api.github.com/repos/nim-lang/Nim/issues/8527"},"comments":{"href":"https://api.github.com/repos/nim-lang/Nim/issues/8527/comments"},"review_comments":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/8527/comments"},"review_comment":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nim-lang/Nim/pulls/8527/commits"},"statuses":{"href":"https://api.github.com/repos/nim-lang/Nim/statuses/eb67b5048073c3b2e4275f3d464ff8d293b4a16b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"GULPF"}}