Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix year validation bug with misbehaving "clock scan" (more likely me misunderstanding it before) |
---|---|
Timelines: | family | ancestors | descendants | both | more-vtypes |
Files: | files | file ages | folders |
SHA1: |
75e8dc5ee83b11806091780bd4b6d5a2 |
User & Date: | aku 2015-03-28 02:21:19.964 |
Context
2015-04-07
| ||
06:09 | Added utility function for substring matching. check-in: 11f8b42694 user: aku tags: more-vtypes | |
2015-03-28
| ||
02:21 | Fix year validation bug with misbehaving "clock scan" (more likely me misunderstanding it before) check-in: 75e8dc5ee8 user: aku tags: more-vtypes | |
2015-03-10
| ||
03:01 | Got fix for history check-in: a94ac7b701 user: aku tags: more-vtypes | |
Changes
Changes to vt_year.tcl.
︙ | ︙ | |||
65 66 67 68 69 70 71 | return {} } proc ::cmdr::validate::year::validate {p x} { debug.cmdr/validate/year {} # Accept short and long year numbers set xa [string tolower $x] | | > > > | | > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | return {} } proc ::cmdr::validate::year::validate {p x} { debug.cmdr/validate/year {} # Accept short and long year numbers set xa [string tolower $x] foreach pattern {%Y-%m-%d %y-%m-%d} { try { # Note how we add fake month and day to both input and # pattern (see above) to ensure proper behaviour from # 'clock scan'. set epoch [clock scan ${xa}-01-01 -format $pattern] } trap {CLOCK badInputString} {e o} { continue } on ok {e o} { # We have an epoch value. # Format it back to a full numeric year set y [clock format $epoch -format %Y] debug.cmdr/validate/year {($xa) $pattern ==> ($epoch) ==> $y} return $y } } fail $p YEAR "a year" $x } # # ## ### ##### ######## ############# ##################### ## Ready |
︙ | ︙ |