#4030 clock scan problems on windows

obsolete: 8.5.2
Christian Nassau

clock scan seems to have an issue with dates before 02 Jan 1970 on Windows XP:

% clock scan "02 Jan 1970"
% clock scan "01 Jan 1970"
time value too large/small to represent

Setting an explicit timezone avoids the problem (i.e. [clock scan "01 Jan 1970" -timezone :GMT] works).

Google knows about a lot of "mktime fails with negative values" complains which might be related.

Also, while investigating this issue, I tried

tcl::clock::ConvertLocalToUTC {stuff that's not important} {} 12345

This gives a segfault (both on Windows and Solaris)


  • Kevin B KENNY
    Kevin B KENNY

    Logged In: YES
    Originator: NO

    Hmm. The issue on Windows XP is puzzling.
    Are you running a stock Tcl installation?
    The symptom is consistent with the default
    timezone being set to :localtime, but that
    shouldn't happen on Windows. Tcl gets the
    system time zone from the Registry, uses
    a tzdata file corresponding to the zone
    if it has one, and generates a Posix-style
    time zone string if it does not.

    Is it possible that you removed the
    $tcl_library/tzdata directory (or the file
    for the zone in question) from your installation?

    In order to troubleshoot this further, let's
    find out the following:

    (1) What's the result of ::tcl::clock::GuessWindowsTimeZone ?

    (If that's :localtime, we need to troubleshoot what's wrong
    with the registry. But I'm guessing that it will have returned
    some actual time zone name.)

    (2) If it returns a correct time zone name, what is it?
    Does the file $tcl_library/tzdata/$timezone (where $timezone
    is the returned timezone) exist? Does the directory
    exist at all?

    If the file doesn't exist, you can no doubt get around
    this problem by fixing your installation. But still,
    even if *that* messes up, too, we're still supposed
    to recover and give a Posix time zone. So something
    is seriously deranged here. Maybe the answers to the
    questions so far will give more of a hint where to look.

    The segfault is a separate issue. Since ConvertLocalToUTC
    is private, I haven't thoroughly tested what it does
    with bad args. Obviously, you've found a combination
    that crashes it. I'll fix that bit while I'm waiting
    for further information.

  • Kevin B KENNY
    Kevin B KENNY

    Logged In: YES
    Originator: NO

    The segfault is fixed, but has nothing to do with the main reported bug.
    Ah... I now have a WinXP system that reproduces the bug. Will investigate

  • Kevin B KENNY
    Kevin B KENNY

    • status: open --> pending-fixed
  • Kevin B KENNY
    Kevin B KENNY

    Logged In: YES
    Originator: NO

    Oh... The registry package doesn't load
    without help when testing Tcl in the
    build directory. Are you perhaps testing
    against an uninstalled Tcl? If
    so, try doing
    load $build_directory/tclreg12.dll Registry
    prior to doing anything with [clock]. If the
    registry package can't be loaded, what
    you describe will be the symptom.

    [make test] and [make runtest] get around this
    by using
    load $::reglib Registry
    to force the registry package into the interpreter
    before attempting to touch [clock].

    If I don't hear otherwise, I'll presume that's
    what happened and let the system close the bug.

    • status: pending-fixed --> closed
  • Logged In: YES
    Originator: YES

    Ah, indeed: we forgot to copy the dde and registry packages when we bundled Tcl on Windows... once they are installed, everything works fine again.

    Sorry for all the fuss. Thanks for the timely response!