diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-19 21:36:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-19 21:36:05 (GMT) |
commit | c611835152c63f8995c427ab9684ecf6125ec2f8 (patch) | |
tree | 6e6b29740e83f83cf96d9912384d170c5c2993e2 /generic/tclInterp.c | |
parent | 81262438a784ae0087c36fabd189c15a2433df33 (diff) | |
download | tcl-c611835152c63f8995c427ab9684ecf6125ec2f8.zip tcl-c611835152c63f8995c427ab9684ecf6125ec2f8.tar.gz tcl-c611835152c63f8995c427ab9684ecf6125ec2f8.tar.bz2 |
Proposed fix for [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 11202ce..613a86a 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -4686,7 +4686,7 @@ ChildTimeLimitCmd( Tcl_Time limitMoment; Tcl_LimitGetTime(childInterp, &limitMoment); - Tcl_SetObjResult(interp, Tcl_NewLongObj(limitMoment.sec)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limitMoment.sec)); } break; } @@ -4744,25 +4744,27 @@ ChildTimeLimitCmd( } limitMoment.usec = ((long) tmp)*1000; break; - case OPT_SEC: + case OPT_SEC: { + Tcl_WideInt sec; secObj = objv[i+1]; (void) Tcl_GetStringFromObj(objv[i+1], &secLen); if (secLen == 0) { break; } - if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { + if (TclGetWideIntFromObj(interp, objv[i+1], &sec) != TCL_OK) { return TCL_ERROR; } - if (tmp < 0) { + if (sec < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "seconds must be at least 0", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "BADVALUE", NULL); return TCL_ERROR; } - limitMoment.sec = tmp; + limitMoment.sec = sec; break; } + } } if (milliObj != NULL || secObj != NULL) { if (milliObj != NULL) { |