aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim.c12
-rw-r--r--jim.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/jim.c b/jim.c
index 8bb5a20..31ff2bf 100644
--- a/jim.c
+++ b/jim.c
@@ -5444,20 +5444,20 @@ int Jim_Collect(Jim_Interp *interp)
}
Jim_FreeHashTable(&marks);
interp->lastCollectId = interp->referenceNextId;
- interp->lastCollectTime = time(NULL);
+ interp->lastCollectTime = JimClock();
return collected;
}
-#define JIM_COLLECT_ID_PERIOD 5000
-#define JIM_COLLECT_TIME_PERIOD 300
+#define JIM_COLLECT_ID_PERIOD 5000000
+#define JIM_COLLECT_TIME_PERIOD 300000
void Jim_CollectIfNeeded(Jim_Interp *interp)
{
unsigned long elapsedId;
- int elapsedTime;
+ jim_wide elapsedTime;
elapsedId = interp->referenceNextId - interp->lastCollectId;
- elapsedTime = time(NULL) - interp->lastCollectTime;
+ elapsedTime = JimClock() - interp->lastCollectTime;
if (elapsedId > JIM_COLLECT_ID_PERIOD || elapsedTime > JIM_COLLECT_TIME_PERIOD) {
@@ -5488,7 +5488,7 @@ Jim_Interp *Jim_CreateInterp(void)
i->maxCallFrameDepth = JIM_MAX_CALLFRAME_DEPTH;
i->maxEvalDepth = JIM_MAX_EVAL_DEPTH;
- i->lastCollectTime = time(NULL);
+ i->lastCollectTime = JimClock();
/* Note that we can create objects only after the
* interpreter liveList and freeList pointers are
diff --git a/jim.h b/jim.h
index f6d5f70..f156980 100644
--- a/jim.h
+++ b/jim.h
@@ -539,7 +539,7 @@ typedef struct Jim_Interp {
is running as sentinel to avoid to recursive
calls via the [collect] command inside
finalizers. */
- time_t lastCollectTime; /* unix time of the last GC execution */
+ jim_wide lastCollectTime; /* unix time of the last GC execution */
Jim_Obj *stackTrace; /* Stack trace object. */
Jim_Obj *errorProc; /* Name of last procedure which returned an error */
Jim_Obj *unknown; /* Unknown command cache */