Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2015-10-23
14:10 • Closed ticket [4a0c163d24]: Win clock locale change not passed to "-locale ... artifact: 78bc391392 user: oehhar
12:55 • Ticket [4a0c163d24]: 4 changes artifact: 061682296e user: oehhar
12:52
Make test clock-67.4 time zone independent. Bug [4a0c163d24] check-in: 3fdcaf2b64 user: oehhar tags: trunk
12:05 • Open ticket [4a0c163d24]: Win clock locale change not passed to "-locale cu... artifact: 7a3a54cae6 user: dgp
08:59 • Closed ticket [4a0c163d24]. artifact: db9c4b5c0a user: oehhar
08:12
Change "clock scan/format -format %x -locale current" output on msgcat locale change. Bug [4a0c163d2... check-in: 5855bdf4a8 user: oehhar tags: trunk
2015-10-21
20:33 • Ticket [4a0c163d24] Win clock locale change not passed to "-locale system&q... artifact: 7561d2f75b user: oehhar
20:30
Change "clock format -format %x -locale current" output on msgcat locale change [4a0c163d24] check-in: e5bf4e6084 user: oehhar tags: bug-4a0c163d24
2015-08-31
11:17 • Ticket [4a0c163d24] Win clock locale change not passed to "-locale system&q... artifact: bb0282767e user: oehhar
08:42 • Ticket [4a0c163d24]: 4 changes artifact: b8e1e55818 user: oehhar
06:58 • Ticket [4a0c163d24]: 4 changes artifact: 36fd7543a0 user: oehhar
2015-08-30
20:23 • Ticket [4a0c163d24]: 4 changes artifact: afffee897b user: dkf
2015-06-30
14:42 • New ticket [4a0c163d24]. artifact: 842aa507a9 user: oehhar

Win clock locale change not passed to "-locale current"

Closed / Fixed4a0c163d24549700a25d1e3a47c2c77477b50a25Created 11 years agoUpdated 11 years ago
Descriptionwiki2015-06-30 14:42:51
Taking this command:
clock format [clock seconds] -locale system -format %x
On windows, the system encoding is taken from *msgcat::mclocale*. If *msgcat::mclocale* changes, the corresponding parse functions are not rebuild.

E.g.:

% mclocale de_de
% clock format [clock seconds] -locale system -format %x
01.07.2015
# mclocale en_us
% clock format [clock seconds] -locale system -format %x
01.07.2015

On the second call, the parser build at the first invokation is reused and not re-initialized due to the locale change. Nevertheless, the used message catalogue should change.

It is not clear to me, if this is an issue. I am writing this ticket to eventually not forget it (also by myself).

----

Addendum to ticket by oehhar:

The upper test is not an issue. The issue arises, if "-locale current" is used. Only windows port makes the difference. The bug is within format and scan. Details in comments. Due to that, renamed title. Hope this is ok...

Referenced by3
  • 3fdcaf2b64Make test clock-67.4 time zone independent. Bug [4a0c163d24] check-in2015-10-23 12:52:19
  • 5855bdf4a8Change "clock scan/format -format %x -locale current" output on msgcat locale change. Bug [4a0c163d24] check-in2015-10-23 08:12:53
  • e5bf4e6084Change "clock format -format %x -locale current" output on msgcat locale change [4a0c163d24] check-in2015-10-21 20:30:49
dkf Ticket [4a0c163d24]: 4 changes [History diff]2015-08-30 20:23:38
oehharplain2015-08-31 06:58:40
At least, I can confirm that this is a bug and should not happen.

Could you confirm if this is in 8.6.4 release or current trunk ?
In the first case please try the current trunk.

Thank you,
Harald
oehharplain2015-08-31 08:42:58
I have tried your test script with tcl 8.5.18, tcl8.6.4 and current trunk.

The issue is present in all version, so this is nothing I have introduced by the msgcat modifications.

There is code to detect that but maybee not at the right places or whatever.

Thank you,
Harald
oehhar Ticket [4a0c163d24]: 3 changes [History diff]2015-08-31 11:17:53
oehharwiki2015-10-21 20:33:40

For the locale "system", %x translates to the msgcat key DATE_FORMAT, which is set by the registry key "HKEY_CURRENT_USER\Control Panel\International->sShortDate"

Here is the global map:

    lappend list %EY [string map $list [mc LOCALE_YEAR_FORMAT]]
    lappend list %T  [string map $list [mc TIME_FORMAT_24_SECS]]
    lappend list %R  [string map $list [mc TIME_FORMAT_24]]
    lappend list %r  [string map $list [mc TIME_FORMAT_12]]
    lappend list %X  [string map $list [mc TIME_FORMAT]]
    lappend list %EX [string map $list [mc LOCALE_TIME_FORMAT]]
    lappend list %x  [string map $list [mc DATE_FORMAT]]
    lappend list %Ex [string map $list [mc LOCALE_DATE_FORMAT]]
    lappend list %c  [string map $list [mc DATE_TIME_FORMAT]]
    lappend list %Ec [string map $list [mc LOCALE_DATE_TIME_FORMAT]]

And here is what is set by the registry (within "HKEY_CURRENT_USER\Control Panel\International") :

  • LOCALE_DATE_FORMAT: sLongDate
  • DATE_FORMAT: sShortDate
  • sTimeFormat: sTimeFormat Those are used to compose:
  • DATE_TIME_FORMAT
  • LOCALE_DATE_TIME_FORMAT

But for the locale current, the msgcat value is used. Thus, the observed action is ok, but is not ok for the locale current. On Unix, "current" and "system" is the same.

Thus the following is a bug:

% mclocale de_de
% clock format [clock seconds] -locale current -format %x
01.07.2015
# mclocale en_us
% clock format [clock seconds] -locale current -format %x
01.07.2015

A proposed solution is implemented by clearing the format functions on the current locale change (for this locale) in branch [bug-4a0c163d24], commit [e5bf4e6084].

oehharwiki2015-10-23 08:59:58

Fix committed to trunk with [5855bdf4a8]. Bug closed.

dgpplain2015-10-23 12:05:52
New test fails:

==== clock-67.4 Change format %x output on global locale change [Bug 4a0c163d24] FAILED
==== Contents of test case:

    msgcat::mclocale de_de
    set res [list [clock format 1 -locale current -format %x]]
    msgcat::mclocale en_uk
    lappend res [clock format 1 -locale current -format %x]

---- Result was:
31.12.1969 12/31/1969
---- Result should have been (exact matching):
01.01.1970 01/01/1970
==== clock-67.4 FAILED
oehharwiki2015-10-23 12:55:11

Sorry, test failure probably due to time zone. Fixed that test only checks format by commit [3fdcaf2b64]. Thank you, Harald

oehhar Closed ticket [4a0c163d24]. [History diff]2015-10-23 14:10:04
Log in (anonymous is fine) to add a comment.