Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7f4cd78874a3d3ba7e77edc3b77120d5963f55ed
Ticket: e7a722cd3573fedda5d1e528f95902776f996e06
confusing precedence of some clock-formats by `clock scan -format`
User & Date: sebres on 2016-12-19 15:21:31
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    IMHO the calculating of precedence and therefore several test cases (e.g. clock-11.x with very confusing and absurdly logic) are wrong.
    
    Example:
    
    ```
    	# from clock-11.1:
    	puts [set d [clock scan {1970-01-01 002} -format "%Y-%m-%d %j" -gmt 1]]\t[clock format $d -format "%Y-%m-%d  %j"]
    	# from clock-11.4:
    	puts [set d [clock scan {002 1970-01-01} -format "%j %Y-%m-%d" -gmt 1]]\t[clock format $d -format "%Y-%m-%d  %j"]
    
    	# returns accordingly:
    	86400	1970-01-02  002
    	0	1970-01-01  001
    ```
    
    But according to `DateParseActions` both "%Y%m%d" and "%Y%j" have the same priority! (but "%Y%m%d" takes place always before "%Y%j"):
    ```
    	{ century yearOfCentury month dayOfMonth } 3 { ... }
    	{ century yearOfCentury dayOfYear } 3 { ... }
            ...
    	{ yearOfCentury month dayOfMonth } 4 { ... }
    	{ yearOfCentury dayOfYear } 4 { ... }
    
    ```
    
    That is IMHO definitive a bug within `MakeParseCodeFromFields` - because if both formats have the same priority, it should return the same result (likely "%Y%m%d" should wins in both cases). At least this logic used in ALL other test cases (e. g. in simplified terms if "month" available "mmdd" over "ddd", otherwise "ddd" over "dd").
    
    It's worse still more that in first case wins prio.3 with "%Y%j" (so second rule!), in second case - prio.4 with "%Y%m%d" (so totally ignores both prio.3 rules)...
    
    I think, as result of this confusing bug, several test cases have been artificially made "correctly".
    
    
    P.S. Request for the fast feedback, because I'm working on newer tcl-clock engine and this is important for me, because my decision rules here are logic-based (not priority-based).
    
  5. foundin changed to: "all"
  6. is_private changed to: "0"
  7. login: "sebres"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Important"
  11. status changed to: "Open"
  12. submitter changed to: "sebres"
  13. subsystem changed to: "16. Commands A-H"
  14. title changed to:
    confusing precedence of some clock-formats by `clock scan -format`
    
  15. type changed to: "Bug"