Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2012-05-30
19:41 • Ticket [3026795fff] clock format %x returns wrong format status still Open w... artifact: 6b3c85eca6 user: kennykb
19:07 • Ticket [3026795fff]: 1 change artifact: 513226dd2b user: dkf
2010-07-08
21:48 • Ticket [3026795fff]: 2 changes artifact: e18446c79f user: dkf
10:47 • New ticket [3026795fff]. artifact: 41fd000c10 user: dunkfan

clock format %x returns wrong format

Open3026795fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 15 years ago
Descriptionplain2010-07-08 10:47:43
In Tcl8.4 on my 32bit Vista Business Machine,
clock format [clock seconds] -format "%x" returns:
08/07/2010  - correct European system todays date 8th July 2010

In 8.5 and 8.6 the same code returns
07/08/2010 - US Style with the month first.

In 8.5, "clock format [clock seconds] -format "%x" -locale current" gives
08/07/10 

which is better...but still not correct as the regional settings are set to output 08/07/2010
dkf Ticket [3026795fff]: 2 changes [History diff]2010-07-08 21:48:16
dkf Ticket [3026795fff]: 1 change [History diff]2012-05-30 19:07:07
kennykbplain2012-05-30 19:41:18
This is actually more of a feature request for '-locale current' (or more likely, '-locale system') to accept the Windows 'regional settings' and construct a [clock] locale from them.  

This is likely a good idea, but it isn't what Tcl does at present; instead, Tcl sets the locale according to language and variant and uses only the message catalog mechanism.

Requiring '-locale' to localise [clock format], with the default being the {} locale, is intentional and by design, so that [clock] by default behaves in a locale-independent manner.  Since most outputs of [clock format] are read by programs rather than by human beings, this is a change that fixed more bugs than it introduced. The alternative, requiring '-locale {}' or '-locale C' to get locale-independent behaviour, was even less palatable.
Log in (anonymous is fine) to add a comment.