Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0a33eb00ee2f018dbb7f7f2470d8bc72876da7e4
Ticket: 1902423fffffffffffffffffffffffffffffffff
clock format gives wrong result
User & Date: gneumann on 2008-02-26 18:55:13
Changes

  1. assignee changed to: "kennykb"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    clock format returns under certain conditions an incorrect "%T" in the formatted time-string, when "%H:%M:%S" was requested
    
    Example (see result of the 2nd [clock format ...]):
    
    % set s [clock seconds]
    1204049747
    % set f1 [clock format $s -format "%Y-%m-%d %T"]
    2008-02-26 19:15:47
    % set f2 [clock format $s -format "%Y-%m-%d %H:%M:%S"]
    2008-02-26 %T
    % set ::tcl_patchLevel
    8.5.1
    
    
    the used locale is "C".
    
    A quick analysis shows that  ParseClockFormatFormat2 builds an incorrect formatting proc:
    ===================
    proc ::tcl::clock::formatproc'%Y-%m-%d %H:%M:%S'C {clockval timezone} {
            
                     variable TZData
                     set date [GetDateFields $clockval $TZData($timezone)  2299161]
                 
            return [::format {%04d-%02d-%02d %%T}  [dict get $date year] [dict get $date month] [dict get $date dayOfMonth]]
    }
    ===================
    One can see that for some reasons, %%T was added to the format string. The reason seems to be that 
    
    LocalizeFormat C {%Y-%m-%d %H:%M:%S}
    returns {%Y-%m-%d %T}, 
    
    most likely due to a caching bug.
    
    
    
  4. foundin changed to: "obsolete: 8.5.1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "gneumann"
  10. subsystem changed to: "06. Time Measurement"
  11. title changed to: "clock format gives wrong result"
  12. type changed to: "Bug"