Tcl Source Code

View Ticket
Login
Ticket UUID: 1237907
Title: Windows crash in clock
Type: Bug Version: obsolete: 8.5a4
Submitter: patthoyts Created on: 2005-07-14 00:24:40
Subsystem: 06. Time Measurement Assigned To: kennykb
Priority: 8 Severity:
Status: Closed Last Modified: 2005-07-16 05:33:22
Resolution: Fixed Closed By: kennykb
    Closed on: 2005-07-15 22:33:22
Description:
[tcl::clock::Localtime -1] will crash tcl on Windows.
The error seems to be in ThreadSafeLocalTime() as far
as I can see. Systems with HAVE_LOCALTIME_R seem to be
fine. Solaris 10 and Linux do not crash.
User Comments: kennykb added on 2005-07-16 05:33:22:
Logged In: YES 
user_id=99768

Right you are.  Also, we shouldn't have been in 'localtime' even
in that case; Windows has provided us with tz conversion
information,
but we discarded it in favor of a tzdata file - that we
subsequently
discovered was missing.  My changes fix that too.

patthoyts added on 2005-07-14 07:47:17:

File Added - 141994: clock.patch

Logged In: YES 
user_id=202636

Windows localtime() can return NULL if the provided time is
< unix epoch.
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_CRT_localtime.asp)

Attached one possible patch. We noticed that Solaris returns
times in 1970 for -1 and -2 but seems to count downwards.
Linux uses 1969.

Attachments: