• clock

    From Manfred Stelzhammer@21:1/5 to All on Wed Apr 19 19:33:34 2023
    Hi

    Why don't get an error:

    clock format [clock scan 2023-22-35 -format %Y-%m-%d] -format "%Y-%m-%d"

    2023-22-35 isn't a guilty date.

    I get: 2024-11-04


    regards Manfred

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Manfred Stelzhammer on Wed Apr 19 18:08:23 2023
    Manfred Stelzhammer <manfred@antispam.at> wrote:
    Hi

    Why don't get an error:

    clock format [clock scan 2023-22-35 -format %Y-%m-%d] -format "%Y-%m-%d"

    2023-22-35 isn't a guilty date.

    I get: 2024-11-04

    The Tcl 8.6 (you didn't say which Tcl, but this behaviour came about in
    8.6) effectively performs a "modulo" on the month and on the day to
    produce a "what you must have meant" result instead of reporting an
    "invaid date" error.

    22 modulo 12 is 10.

    35 modulo 31 (month 10 has 31 days) is 4

    so you get "11-04" out (10 plus a month for the 31 days in 35).

    Personally I'd have preferred an "invalid date" error.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to Rich on Wed Apr 19 16:51:19 2023
    On 4/19/2023 2:08 PM, Rich wrote:

    The Tcl 8.6 (you didn't say which Tcl, but this behaviour came about in
    8.6) effectively performs a "modulo" on the month and on the day to
    produce a "what you must have meant" result instead of reporting an
    "invaid date" error.

    22 modulo 12 is 10.

    35 modulo 31 (month 10 has 31 days) is 4


    That is some wild fix! I have seen some systems use 13+ months as
    "extra" number of months to add so that 24 would be added as two years,
    and similarly for days, but never a modulo. And the day modulo is
    really dependent on what the month ends up to be?

    Personally I'd have preferred an "invalid date" error.

    Me too.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)