Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Windows crash in clock

Closed / Fixed1237907fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-07-14 00:24:40
[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.
patthoytsplain2005-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.
kennykbplain2005-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.
Log in (anonymous is fine) to add a comment.

Attachments: