{"action":"opened","issue":{"url":"https://api.github.com/repos/xp-runners/reference/issues/65","repository_url":"https://api.github.com/repos/xp-runners/reference","labels_url":"https://api.github.com/repos/xp-runners/reference/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/xp-runners/reference/issues/65/comments","events_url":"https://api.github.com/repos/xp-runners/reference/issues/65/events","html_url":"https://github.com/xp-runners/reference/issues/65","id":179214662,"number":65,"title":"Timezone not set correctly","user":{"login":"thekid","id":696742,"avatar_url":"https://avatars.githubusercontent.com/u/696742?v=3","gravatar_id":"","url":"https://api.github.com/users/thekid","html_url":"https://github.com/thekid","followers_url":"https://api.github.com/users/thekid/followers","following_url":"https://api.github.com/users/thekid/following{/other_user}","gists_url":"https://api.github.com/users/thekid/gists{/gist_id}","starred_url":"https://api.github.com/users/thekid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thekid/subscriptions","organizations_url":"https://api.github.com/users/thekid/orgs","repos_url":"https://api.github.com/users/thekid/repos","events_url":"https://api.github.com/users/thekid/events{/privacy}","received_events_url":"https://api.github.com/users/thekid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-26T12:27:31Z","updated_at":"2016-09-26T12:27:31Z","closed_at":null,"body":"I noticed this in Docker containers:\r\n\r\n```sh\r\n$ TZ=Europe/Berlin xp -w '\\util\\Date::now()'\r\n2016-09-26 11:25:08+0000\r\n#                  ^^^^^\r\n#                  Should read +0200!\r\n```\r\n\r\nMono's timezone is inferred by checking the symlink target of `/etc/localtime` - see https://github.com/mono/mono/pull/1989/files. Unfortuntaley this solution only works if `/etc/localtime` is actually a symlink, which on our systems it's not:\r\n\r\n```sh\r\n# Neither on the host...\r\ndocker@fedockera02:~$ ls -al /etc/localtime\r\n-rw-r--r-- 1 root root 2309 Sep  7 11:32 /etc/localtime\r\n\r\n# ...nor inside Docker\r\ndocker@fedockera02:~$ docker run --rm -it registry.example.org/os/debian:jessie /bin/bash\r\nroot@c37182cdff58:/# ls -al /etc/localtime\r\n-rw-r--r-- 1 root root 118 Sep 19 16:19 /etc/localtime\r\n\r\n# ...but even if it was, it points to something incorrect:\r\nroot@c37182cdff58:/# cat /etc/localtime\r\nTZif2UTCTZif2UTC\r\nUTC0\r\n```\r\n\r\nSolutions I've found on Stackoverflow suggest traversing `/usr/share/zoneinfo/` and finding files with the same md5sum as `/etc/localtime`. We could also execute `timedatectl`, but the latter doesn't work inside Docker containers:\r\n\r\n```sh\r\nroot@c37182cdff58:/# timedatectl\r\nFailed to create bus connection: No such file or directory\r\n```\r\n\r\nThe suggestion would be to also take the environment variable `TZ` into consideration. It can easily be passed to docker containers via environment."}}
{"actor":{"display_login":"thekid"}}