Skip to content
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

time: zone discovery logic fails on non-English versions of Windows #5783

Closed
alexbrainman opened this issue Jun 26, 2013 · 9 comments

Comments

Projects
None yet
4 participants
@alexbrainman
Copy link
Member

commented Jun 26, 2013

From https://golang.org/issue/3790?c=11

#11 matrixik
I found one more:
MST

--- FAIL: TestLocalZoneAbbr (0.00 seconds)
        zoneinfo_windows_test.go:18: Parse failed: parsing time "Sat, 22 Jun 2013 13:42:36 +0200" as "Mon, 02 Jan 2006 15:04:05 MST": cannot parse "+0200" as "MST"

Windows 7 x32
go version devel +56909cb770fe Fri Jun 21 18:07:57 2013 -0700 windows/386

Best regards,
Dobrosław Żybort
Jun 23 (47 hours ago) Delete comment Project Member #12 alex.brainman
matrixik,

Do you mind running this program http://play.golang.org/p/vCsioBDpMk on your computer
and reporting results back here? I suspect your syscall.Timezoneinformation is different
from what Go supports at this moment. And I am wonering why and what to do about it.

Thank you.

Alex

Today (12 hours ago) #13 matrixik
Alex,

Results:

```
i=syscall.Timezoneinformation{Bias:-60, StandardName:[32]uint16{0x15a, 0x72, 0x6f, 0x64,
0x6b, 0x6f, 0x77, 0x6f, 0x65, 0x75, 0x72, 0x6f, 0x70, 0x65, 0x6a, 0x73, 0x6b, 0x69,
0x20, 0x63, 0x7a, 0x61, 0x73, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x2e, 0x0, 0x0},
StandardDate:syscall.Systemtime{Year:0x0, Month:0xa, DayOfWeek:0x0, Day:0x5, Hour:0x3,
Minute:0x0, Second:0x0, Milliseconds:0x0}, StandardBias:0,
DaylightName:[32]uint16{0x15a, 0x72, 0x6f, 0x64, 0x6b, 0x6f, 0x77, 0x6f, 0x65, 0x75,
0x72, 0x6f, 0x70, 0x65, 0x6a, 0x73, 0x6b, 0x69, 0x20, 0x63, 0x7a, 0x61, 0x73, 0x20,
0x6c, 0x65, 0x74, 0x6e, 0x69, 0x0, 0x0, 0x0}, DaylightDate:syscall.Systemtime{Year:0x0,
Month:0x3, DayOfWeek:0x0, Day:0x5, Hour:0x2, Minute:0x0, Second:0x0, Milliseconds:0x0},
DaylightBias:-60}
i.StandardName="Środkowoeuropejski czas stand."
i.DaylightName="Środkowoeuropejski czas letni"
```

Where:
Środkowoeuropejski czas stand. = Central European Standard Time.
Środkowoeuropejski czas letni = Central European Summer Time

Best regards,
Dobrosław Żybort
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2013

Comment 1:

matrixik,
We use https://code.google.com/p/go/source/browse/src/pkg/time/zoneinfo_abbrs_windows.go
table to translate Windows zone names reported via GetTimeZoneInformation winapi into
zone abbreviations required for time.Format function. As you can see, our table includes
English only descriptions, while your system returns names in your local language.
I am not sure what to do. We need English zone names for our approach to work. I don't
see us adding appropriate strings for every language we find. Not yet anyway.
So I am trying to find a way to translate these into English in some clever way. The
time zone information is stored in the registry. It is stored in
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" key on my
computer (you must use regedit program to access it). You have your non-English strings
stored there somewhere, but perhaps you have English strings there too (they are not
exposed via GetTimeZoneInformation api). Perhaps there is enough information there so we
could do the translation. Could you, please, send us the contents of
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" key (just
right click on the key and select "export" menu option and save it to a file and post it
here. The file will have *all* timezones from your computer. Feel free to email file
privately, if you like.
I am opened to any suggestions from everyone.
Thank you
Alex
@matrixik

This comment has been minimized.

Copy link

commented Jun 26, 2013

Comment 2:

Time zone keys names are still in English, `Dlt`, `Std` and `Display` strings are in
Polish.
Best regards,
Dobrosław Żybort

Attachments:

  1. windows7_pl_time_zones.reg (194814 bytes)
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2013

Comment 3:

matrixik,
Thank you for the file. I can see (you could too) that appropriate registry keys have
English names we require. Perhaps it will be enough to fix our problem. I will have a go
at it when I have time.
Alex
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Jul 5, 2013

Comment 4:

matrixik,
Can you, please check if https://golang.org/cl/10956043/ fixes your problem.
Thank you.
Alex

Status changed to Started.

@matrixik

This comment has been minimized.

Copy link

commented Jul 6, 2013

Comment 5:

When I apply it all tests pass.
Thank you.
Best regards,
Dobrosław Żybort
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2013

Comment 6:

This issue was closed by revision 231dfd9.

Status changed to Fixed.

@matrixik

This comment has been minimized.

Copy link

commented Jul 10, 2013

Comment 7:

Thank you.
Best regards,
Dobrosław Żybort
@snaury

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2013

Comment 8:

Unfortunately, the fix seems to be incomplete, since I see a slightly different error
with this test:
--- FAIL: TestLocalZoneAbbr (0.00 seconds)
zoneinfo_windows_test.go:18: Parse failed: parsing time "Wed, 07 Aug 2013 00:30:36 MSK"
as "Mon, 02 Jan 2006 15:04:05 MST": cannot parse "MSK" as "MST"
FAIL
FAIL time 3.849s
So it is formatted correctly, but not parsed. My data:
i=syscall.Timezoneinformation{Bias:-240, StandardName:[32]uint16{0x41c, 0x43e, 0x441,
0x43a, 0x43e, 0x432, 0x441, 0x43a, 0x43e, 0x435, 0x20, 0x432, 0x440, 0x435, 0x43c,
0x44f, 0x20, 0x28, 0x437, 0x438, 0x43c, 0x430, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0}, StandardDate:syscall.Systemtime{Year:0x0, Month:0x0, DayOfWeek:0x0, Day:0x0,
Hour:0x0, Minute:0x0, Second:0x0, Milliseconds:0x0}, StandardBias:0,
DaylightName:[32]uint16{0x41c, 0x43e, 0x441, 0x43a, 0x43e, 0x432, 0x441, 0x43a, 0x43e,
0x435, 0x20, 0x432, 0x440, 0x435, 0x43c, 0x44f, 0x20, 0x28, 0x43b, 0x435, 0x442, 0x43e,
0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,0x0, 0x0},
DaylightDate:syscall.Systemtime{Year:0x0, Month:0x0, DayOfWeek:0x0, Day:0x0, Hour:0x0,
Minute:0x0, Second:0x0, Milliseconds:0x0}, DaylightBias:-60}
i.StandardName="Московское время (зима)"
i.DaylightName="Московское время (лето)"
It translates as "Moscow time (winter)", "Moscow time (summer)".
@snaury

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2013

Comment 9:

Ah, sorry, it's a different issue after all.

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.