• clock command supporting 64 bit int

    From wwaii@alwayseen@yahoo.com to comp.lang.tcl on Tue Jan 13 20:33:55 2026
    From Newsgroup: comp.lang.tcl

    i am surprised that Tcl 9 clock command doesn't support 64 bit integer.

    is there a way to support it? or i am doing something wrong below?


    (bin) 1 % info patch
    9.0.3
    (bin) 2 % parray tcl_platform
    tcl_platform(byteOrder) = littleEndian
    tcl_platform(engine) = Tcl
    tcl_platform(machine) = amd64
    tcl_platform(os) = Windows NT
    tcl_platform(osVersion) = 10.0
    tcl_platform(pathSeparator) = ;
    tcl_platform(platform) = windows
    tcl_platform(pointerSize) = 8
    tcl_platform(user) = x
    tcl_platform(wordSize) = 4
    (bin) 3 % expr 2 **31
    2147483648
    (bin) 4 % clock format 2147483648 -gmt 1
    Tue Jan 19 03:14:08 GMT 2038
    (bin) 5 % expr 2 ** 63
    9223372036854775808
    (bin) 6 % clock format 9223372036854775808 -gmt 1
    integer value too large to represent
    (bin) 7 %
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Wed Jan 14 07:39:20 2026
    From Newsgroup: comp.lang.tcl

    Am 14.01.26 um 02:33 schrieb wwaii:
    i am surprised that Tcl 9 clock command doesn't support 64 bit integer.

    is there a way to support it? or i am doing something wrong below?

    (bin) 3 % expr 2 **31
    2147483648
    (bin) 4 % clock format 2147483648 -gmt 1
    Tue Jan 19 03:14:08 GMT 2038
    (bin) 5 % expr 2 ** 63
    9223372036854775808
    (bin) 6 % clock format 9223372036854775808 -gmt 1
    integer value too large to represent
    (bin) 7 %

    It does support values beyond 32 bit:

    (Pass) 50 % expr 2 ** 35
    34359738368
    (Pass) 51 % clock format 34359738368 -gmt 1
    Tue Oct 26 03:46:08 GMT 3058
    (Pass) 52 %

    the value you chose is just insanely large, I guess that the year
    overflows the 64 bit for display. I'm not sure that we will use Tcl
    still in 292 Billion years ;)

    Christian
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Wed Jan 14 09:05:12 2026
    From Newsgroup: comp.lang.tcl

    Am 14.01.2026 um 02:33 schrieb wwaii:
    i am surprised that Tcl 9 clock command doesn't support 64 bit integer.

    is there a way to support it? or i am doing something wrong below?


    (bin) 1 % info patch
    9.0.3
    (bin) 2 % parray tcl_platform
    tcl_platform(byteOrder)     = littleEndian tcl_platform(engine)        = Tcl
    tcl_platform(machine)       = amd64 tcl_platform(os)            = Windows NT tcl_platform(osVersion)     = 10.0
    tcl_platform(pathSeparator) = ;
    tcl_platform(platform)      = windows
    tcl_platform(pointerSize)   = 8
    tcl_platform(user)          = x
    tcl_platform(wordSize)      = 4
    (bin) 3 % expr 2 **31
    2147483648
    (bin) 4 % clock format 2147483648 -gmt 1
    Tue Jan 19 03:14:08 GMT 2038
    (bin) 5 % expr 2 ** 63
    9223372036854775808
    (bin) 6 % clock format 9223372036854775808 -gmt 1
    integer value too large to represent
    (bin) 7 %

    Sergey may comment on this.

    It is somewhere between 32 and 64 bit.

    % set t [expr {2 ** 63 / 1000}]
    9223372036854775
    % clock format $t -gmt 1
    Sun Aug 17 07:12:55 GMT 292278994

    I agree, that this year is quite theoretical.

    Also remark, that it also looks back with negative values.
    At some moment, there is an overflow.

    Harald



    --- Synchronet 3.21a-Linux NewsLink 1.2