Tcl Source Code

View Ticket
Login
Ticket UUID: 3026795
Title: clock format %x returns wrong format
Type: Bug Created on: 2010-07-08 10:47:43
Submitter: dunkfan Assigned to: kennykb
Subsystem: 06. Time Measurement Severity:
Priority: 7 High Last modified: 2012-05-30 19:41:18
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.5.8
Description:
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
User Comments:
kennykb added on 2012-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.