<i>Free-form clock scan silently wraps numbers that do not fit into an int (regression in 9.0)</i>.
by
.
D 2026-11-14T08:05:35.979
J assignee nobody
J closer nobody
J cmimetype text/x-markdown
J comment Since\sthe\sclock\srewrite\sin\sTcl\s9.0\s(TIP\s688),\sthe\sfree-form\sparser\sof\s`clock\sscan`\sreads\snumbers\sas\s64-bit\sintegers,\sbut\sstores\sthem\sinto\sthe\s`int`\sfields\sof\sthe\sdate\s(hour,\sminutes,\sday,\smonth,\syear,\sday\sordinal).\sA\snumber\sthat\sdoes\snot\sfit\sinto\san\sint\sis\struncated,\sand\sthe\sresult\sis\soften\sa\svalid\svalue,\sso\sa\swrong\sdate\sis\sreturned\swithout\serror:\n\n|\sInput\s|\s9.0.5\sand\s9.1.1\s|\s8.6.18\s|\n|---|---|---|\n|\s`clock\sscan\s12:4294967301:00`\s|\s12:05:00\s|\ssyntax\serror\s|\n|\s`clock\sscan\s4294967308:00:00`\s|\s12:00:00\s|\ssyntax\serror\s|\n|\s`clock\sscan\s4294967297/02/2026`\s|\s2026-01-02\s|\ssyntax\serror\s|\n|\s`clock\sscan\s02/4294967297/2026`\s|\s2026-02-01\s|\ssyntax\serror\s|\n|\s`clock\sscan\s02/03/4294969322`\s|\s2026-02-03\s|\ssyntax\serror\s|\n|\s`clock\sscan\s"-4294967297\sMonday"`\s|\s1969-12-29\s(a\sMonday)\s|\ssyntax\serror\s|\n\nWith\sJan's\sfix\sfor\s[8afd93d3d3],\swhich\smakes\s`secondOfMin`\san\sint,\sthe\sseconds\sfield\swould\sbe\saffected\stoo:\s`12:00:4294967301`\swould\sgive\s12:00:05.\n\nThe\syear\sis\sthe\sonly\sfield\swhose\svalid\srange\s(`-min-year`/`-max-year`)\sis\sthe\swhole\sint\srange\sby\sdefault,\sso\sclamping\salone\scannot\sreject\sit.\n\nRelative\smonths\sand\syears\sare\swrapped\stoo\s(with\s`-base\s0\s-gmt\s1`):\n\n|\sInput\s|\s9.0.5\sand\s9.1.1\s|\n|---|---|\n|\s`clock\sscan\s"4294967297\smonths"`\s|\s1970-02-01\s(1\smonth)\s|\n|\s`clock\sscan\s"4294967297\syears"`\s|\s1971-01-01\s(1\syear)\s|\n|\s`clock\sscan\s"next\s4294967297\sFeb"`\s|\s1970-02-01\s|\n\nRelative\sdays,\sweeks,\sfortnights\sand\sseconds\sare\s64-bit\sand\sgive\sthe\sright\sresult.\s8.6.18\sgives\swrong\sresults\sfor\sall\srelative\sunits\swith\sthis\snumber\s(the\syear\s429502\sfor\seach\sof\sthem)\sand\sa\ssyntax\serror\sfor\s`next\s4294967297\sFeb`.
J foundin 9.0.5,\s9.1.1
J is_private 0
J login serhiy.storchaka
J priority 5\sMedium
J resolution None
J severity Important
J status Open
J submitter serhiy.storchaka
J subsystem 06.\sTime\sMeasurement
J title Free-form\sclock\sscan\ssilently\swraps\snumbers\sthat\sdo\snot\sfit\sinto\san\sint\s(regression\sin\s9.0)
J type Bug
K f894a85b9a4412d77d4f3234e5a244b7b4d476a2
U serhiy.storchaka
Z 0e94ec78d084bb02907d9fe96a5b09db