Tcl Source Code

Artifact [8a5f45e7c0]
Login

Artifact 8a5f45e7c0aeb4253a7647caa202a500002917f0:

Attachment "clock.patch" to ticket [1237907fff] added by patthoyts 2005-07-14 07:47:17.
Index: generic/tclClock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclClock.c,v
retrieving revision 1.37
diff -u -r1.37 tclClock.c
--- generic/tclClock.c	30 Oct 2004 18:04:00 -0000	1.37
+++ generic/tclClock.c	14 Jul 2005 00:36:38 -0000
@@ -214,7 +214,13 @@
     localtime_r(timePtr, tmPtr);
 #else
     Tcl_MutexLock(&clockMutex);
-    memcpy((VOID *) tmPtr, (VOID *) localtime(timePtr), sizeof(struct tm));
+    {
+        struct tm *localPtr = localtime(timePtr);
+        if (localPtr == NULL)
+            memset((VOID *) tmPtr, 0, sizeof(struct tm));
+        else
+            memcpy((VOID *) tmPtr, (VOID *) localPtr, sizeof(struct tm));
+    }
     Tcl_MutexUnlock(&clockMutex);
 #endif    
     return tmPtr;