-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not get current timezone on WSL (Windows Subsystem for Linux) #102
Comments
Wow, looks like you're on the bleeding edge! I had not even heard of this platform. Thanks for the excellent description of the problem! You are the first to try to run tz on this platform. Just skimming their docs the only thing I'm picking up is in the release notes (https://msdn.microsoft.com/en-us/commandline/wsl/release_notes) it says:
I find myself wondering if the Windows version of Currently it looks like you're in the driver's seat for getting this ported, and that would be much appreciated! More clues, but not a clear answer: microsoft/WSL#856 |
Currently I see only two solutions: replace the file with a symlink or parse it manually. Since this platform is targeted at developers, the first option seems to be the right way to solve the problem and wait for Microsoft to fix it. I've reported it. rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime This seems to persist through a reboot but |
Does |
I don't think so. This is what qis@core ~ zdump /etc/localtime.orig
/etc/localtime.orig Sat Nov 19 23:11:40 2016 STD
qis@core ~ zdump -v /etc/localtime.orig
/etc/localtime.orig -9223372036854775808 = NULL
/etc/localtime.orig -9223372036854689408 = NULL
/etc/localtime.orig Sun Mar 26 00:59:59 2006 UT = Sun Mar 26 01:59:59 2006 STD isdst=0 gmtoff=3600
/etc/localtime.orig Sun Mar 26 01:00:00 2006 UT = Sun Mar 26 03:00:00 2006 DST isdst=1 gmtoff=7200
# === 1972 more lines ===
/etc/localtime.orig Sun Oct 25 00:59:59 2499 UT = Sun Oct 25 02:59:59 2499 DST isdst=1 gmtoff=7200
/etc/localtime.orig Sun Oct 25 01:00:00 2499 UT = Sun Oct 25 02:00:00 2499 STD isdst=0 gmtoff=3600
/etc/localtime.orig 9223372036854689407 = NULL
/etc/localtime.orig 9223372036854775807 = NULL
qis@core ~ strings /etc/localtime.orig
TZif2
TZif2
STD-1DST,M3.5.0/2:00:00,M10.5.0/3:00:00 Edit: Added |
I see, thanks. That is almost useless for getting the current zone. We could get the approximate offset and abbreviation, but that's not enough to nail down the zone. If you force the |
Nice bug report. I'll be anxious to see a response. |
I'm not aware of a way to call Win32 APIs from within the bash environment. One could check the qis@core ~ /mnt/c/Windows/System32/tzutil.exe /g
bash: /mnt/c/Windows/System32/tzutil.exe: cannot execute binary file: Exec format error Will respond again if I find something. Edit: No solution in sight. Probably best to fix the WSL installation manually and let MS deal with it. |
afaik, this is still not fixed on WSL install, but your fix is the correct way of fixing it. |
See also microsoft/WSL#3747 |
Not to be fixed. |
Windows 10 Bash on Ubuntu on Windows issue.
When the function
date::current_zone()
is called,tz.cpp
throws the runtime error "Could not get current timezone". Here are the problems:/etc/localtime
is not a symlink./etc/timezone
does not exist./etc/sysconfig/clock
does not exist./usr/share/zoneinfo
that matches/etc/localtime
.Can somebody confirm that this is always the case or do I have a broken system?
The text was updated successfully, but these errors were encountered: