diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-22 22:53:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-22 22:53:36 (GMT) |
commit | c08798d0f4d72da0623ce1f4dbe93f8a542e18b4 (patch) | |
tree | 06776f10acbc9ed936be0a964e1baba196b9d4e0 | |
parent | 4ef7c0c4b836759619b399102ea01f01b4a61165 (diff) | |
parent | c611835152c63f8995c427ab9684ecf6125ec2f8 (diff) | |
download | tcl-c08798d0f4d72da0623ce1f4dbe93f8a542e18b4.zip tcl-c08798d0f4d72da0623ce1f4dbe93f8a542e18b4.tar.gz tcl-c08798d0f4d72da0623ce1f4dbe93f8a542e18b4.tar.bz2 |
Fix [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem
-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) { |