Ticket UUID: | 1505383 | |||
Title: | clock format %W broken | |||
Type: | Bug | Version: | obsolete: 8.5a5 | |
Submitter: | tallniel | Created on: | 2006-06-13 12:55:14 | |
Subsystem: | 06. Time Measurement | Assigned To: | kennykb | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2006-07-31 02:01:45 | |
Resolution: | Fixed | Closed By: | kennykb | |
Closed on: | 2006-07-30 19:01:45 | |||
Description: |
clock format %W option is broken in current CVS: % info pa 8.5a5 % clock format [clock seconds] -format %W can't read "Wweeknumber": no such variable % set errorInfo can't read "Wweeknumber": no such variable while executing "::format %02d $Wweeknumber" (procedure "::tcl::clock::formatproc'%W'C" line 11) invoked from within "$formatter $clockval $timezone" (procedure "::tcl::clock::format" line 74) invoked from within "::tcl::clock::format 1150202323 -format %W" ("uplevel" body line 1) invoked from within "uplevel 1 [info level 0]" (procedure "::tcl::clock::format" line 4) invoked from within "clock format [clock seconds] -format %W" % info body tcl::clock::formatproc'%W'C variable TZData set date [GetDateFields $clockval $TZData($timezone) 2299161] set WweekNumber [expr { ( [dict get $date dayOfYear] - [dict get $date dayOfWeek] + 7 ) / 7 }] return [::format %02d $Wweeknumber] The problem is this last reference to $Wweeknumber in the format: the 'n' should be capitalised. As this is generated code, the actual bug is in library/clock.tcl line 4625, proc tcl::clock::ParseClockFormatFormat2. I attach a patch that fixes this. | |||
User Comments: |
kennykb added on 2006-07-31 02:01:45:
Logged In: YES user_id=99768 Joe Mistachkin's comments are a separate bug, which would get tickled in some combinations of %E without %O. Neil's analysis of the %W bug is fixed. (Neil, why on Earth were you using %W, anyway? The ISO week number is %V - %W is for compatibility with some legacy software but is not correct for any known calendar.) Both bugs are now fixed. mistachkin added on 2006-06-14 00:41:08: Logged In: YES user_id=113501 I think some of the other format specifiers are also broken (at least %Ey and %EY): clock format [clock seconds] -format %Ey % can't use empty string as operand of "-" while executing "expr { [dict get $date year] - [lindex $etable $index 2] }" (procedure "GetLocaleEra" line 9) invoked from within "GetLocaleEra $date[set date {}] {}" (procedure "::tcl::clock::formatproc'%Ey'C" line 6) invoked from within "$formatter $clockval $timezone" (procedure "::tcl::clock::format" line 74) invoked from within "clock format [clock seconds] -format %Ey" tallniel added on 2006-06-13 19:55:15: File Added - 181506: clockformatW.patch |
Attachments:
- clockformatW.patch [download] added by tallniel on 2006-06-13 19:55:15. [details]