summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-09-11 18:57:56 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-09-11 18:57:56 (GMT)
commite1dec685e9bda26a664969e11607fabc328c582c (patch)
tree1d2452bcda99b379a6cff5ce3eb4924082bc5153 /generic/tclClock.c
parent80f7a77b4a8d0abf89b50cc8fc656420bde8fed0 (diff)
downloadtcl-e1dec685e9bda26a664969e11607fabc328c582c.zip
tcl-e1dec685e9bda26a664969e11607fabc328c582c.tar.gz
tcl-e1dec685e9bda26a664969e11607fabc328c582c.tar.bz2
* generic/tclClock.c (TclMktimeObjCmd): Corrected a bad check
for error return from 'mktime'. * generic/tclObj.c (Tcl_GetIntFromObj): Corrected a problem where demoting a wide to an int failed on a big-endian machine. [Bug 1026125]. * tests/clock.test (clock-43.1): Added regression test for error return from 'mktime'.
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index e348d58..2f54977 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclClock.c,v 1.31 2004/09/08 15:38:33 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.32 2004/09/11 18:57:56 kennykb Exp $
*/
#include "tclInt.h"
@@ -224,6 +224,7 @@ TclClockMktimeObjCmd( ClientData clientData,
int i;
struct tm toConvert; /* Time to be converted */
time_t convertedTime; /* Time converted from mktime */
+ int localErrno;
/* Convert parameters */
@@ -265,12 +266,14 @@ TclClockMktimeObjCmd( ClientData clientData,
TzsetIfNecessary();
Tcl_MutexLock( &clockMutex );
+ errno = 0;
convertedTime = mktime( &toConvert );
+ localErrno = errno;
Tcl_MutexUnlock( &clockMutex );
/* Return the converted time, or an error if conversion fails */
- if ( convertedTime == -1 ) {
+ if ( localErrno != 0 ) {
Tcl_SetObjResult
( interp,
Tcl_NewStringObj( "time value too large/small to represent",