summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.decls9
-rw-r--r--generic/tclClock.c4
-rw-r--r--generic/tclCmdMZ.c10
-rw-r--r--generic/tclCompile.c6
-rw-r--r--generic/tclDecls.h9
-rw-r--r--generic/tclInt.decls5
-rw-r--r--generic/tclInt.h3
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--generic/tclTest.c50
-rw-r--r--generic/tclTimer.c10
-rw-r--r--generic/tclUtil.c30
11 files changed, 90 insertions, 49 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 3731c10..722cc80 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tcl.decls,v 1.65 2001/10/16 05:31:17 dgp Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.66 2001/11/21 02:36:20 hobbs Exp $
library tcl
@@ -1687,7 +1687,12 @@ declare 480 generic {
declare 481 generic {
int Tcl_EvalTokensStandard(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count)
}
-
+
+# New export due to TIP#73
+declare 482 generic {
+ void Tcl_GetTime( Tcl_Time* timeBuf )
+}
+
##############################################################################
# Define the platform specific public Tcl interface. These functions are
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 583d399..9a99deb 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -11,7 +11,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.11 2000/08/18 18:02:16 ericm Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.12 2001/11/21 02:36:20 hobbs Exp $
*/
#include "tcl.h"
@@ -109,7 +109,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
* We can enforce at least millisecond granularity
*/
Tcl_Time time;
- TclpGetTime(&time);
+ Tcl_GetTime(&time);
Tcl_SetLongObj(resultPtr,
(long) (time.sec*1000 + time.usec/1000));
} else {
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 836c080..34af105 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.49 2001/11/19 14:35:54 dkf Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.50 2001/11/21 02:36:20 hobbs Exp $
*/
#include "tclInt.h"
@@ -2673,17 +2673,17 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
objPtr = objv[1];
i = count;
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
while (i-- > 0) {
result = Tcl_EvalObjEx(interp, objPtr, 0);
if (result != TCL_OK) {
return result;
}
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
- totalMicroSec =
- (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
+ totalMicroSec = ( ( (double) ( stop.sec - start.sec ) ) * 1.0e6
+ + ( stop.usec - start.usec ) );
sprintf(buf, "%.0f microseconds per iteration",
((count <= 0) ? 0 : totalMicroSec/count));
Tcl_ResetResult(interp);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 3e71ee7..c5f9767 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.27 2001/11/14 23:17:03 hobbs Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.28 2001/11/21 02:36:20 hobbs Exp $
*/
#include "tclInt.h"
@@ -592,7 +592,7 @@ TclCleanupByteCode(codePtr)
(double) (codePtr->numAuxDataItems * sizeof(AuxData));
statsPtr->currentCmdMapBytes -= (double) codePtr->numCmdLocBytes;
- TclpGetTime(&destroyTime);
+ Tcl_GetTime(&destroyTime);
lifetimeSec = destroyTime.sec - codePtr->createTime.sec;
if (lifetimeSec > 2000) { /* avoid overflow */
lifetimeSec = 2000;
@@ -1630,7 +1630,7 @@ TclInitByteCodeObj(objPtr, envPtr)
#ifdef TCL_COMPILE_STATS
codePtr->structureSize = structureSize
- (sizeof(size_t) + sizeof(Tcl_Time));
- TclpGetTime(&(codePtr->createTime));
+ Tcl_GetTime(&(codePtr->createTime));
RecordByteCodeStats(codePtr);
#endif /* TCL_COMPILE_STATS */
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index a1c6a4d..0e67b7b 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDecls.h,v 1.65 2001/10/16 05:31:17 dgp Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.66 2001/11/21 02:36:20 hobbs Exp $
*/
#ifndef _TCLDECLS
@@ -1507,6 +1507,8 @@ EXTERN void Tcl_FSMountsChanged _ANSI_ARGS_((
EXTERN int Tcl_EvalTokensStandard _ANSI_ARGS_((
Tcl_Interp * interp, Tcl_Token * tokenPtr,
int count));
+/* 482 */
+EXTERN void Tcl_GetTime _ANSI_ARGS_((Tcl_Time* timeBuf));
typedef struct TclStubHooks {
struct TclPlatStubs *tclPlatStubs;
@@ -2048,6 +2050,7 @@ typedef struct TclStubs {
int (*tcl_OutputBuffered) _ANSI_ARGS_((Tcl_Channel chan)); /* 479 */
void (*tcl_FSMountsChanged) _ANSI_ARGS_((Tcl_Filesystem * fsPtr)); /* 480 */
int (*tcl_EvalTokensStandard) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Token * tokenPtr, int count)); /* 481 */
+ void (*tcl_GetTime) _ANSI_ARGS_((Tcl_Time* timeBuf)); /* 482 */
} TclStubs;
#ifdef __cplusplus
@@ -4016,6 +4019,10 @@ extern TclStubs *tclStubsPtr;
#define Tcl_EvalTokensStandard \
(tclStubsPtr->tcl_EvalTokensStandard) /* 481 */
#endif
+#ifndef Tcl_GetTime
+#define Tcl_GetTime \
+ (tclStubsPtr->tcl_GetTime) /* 482 */
+#endif
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 815b88c..5ae28d9 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -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: tclInt.decls,v 1.36 2001/11/14 23:17:03 hobbs Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.37 2001/11/21 02:36:20 hobbs Exp $
library tcl
@@ -301,9 +301,12 @@ declare 75 generic {
declare 76 generic {
unsigned long TclpGetSeconds(void)
}
+
+# deprecated
declare 77 generic {
void TclpGetTime(Tcl_Time *time)
}
+
declare 78 generic {
int TclpGetTimeZone(unsigned long time)
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index ba3fa91..db8e17c 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -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: tclInt.h,v 1.69 2001/11/14 23:17:03 hobbs Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.70 2001/11/21 02:36:20 hobbs Exp $
*/
#ifndef _TCLINT
@@ -1801,7 +1801,6 @@ EXTERN unsigned long TclpGetClicks _ANSI_ARGS_((void));
EXTERN Tcl_Channel TclpGetDefaultStdChannel _ANSI_ARGS_((int type));
EXTERN long TclpGetGMTOffset _ANSI_ARGS_((void));
EXTERN unsigned long TclpGetSeconds _ANSI_ARGS_((void));
-EXTERN void TclpGetTime _ANSI_ARGS_((Tcl_Time *time));
EXTERN int TclpGetTimeZone _ANSI_ARGS_((unsigned long time));
EXTERN char * TclpGetUserHome _ANSI_ARGS_((CONST char *name,
Tcl_DString *bufferPtr));
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index d054121..a483664 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubInit.c,v 1.63 2001/11/14 23:17:04 hobbs Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.64 2001/11/21 02:36:20 hobbs Exp $
*/
#include "tclInt.h"
@@ -882,6 +882,7 @@ TclStubs tclStubs = {
Tcl_OutputBuffered, /* 479 */
Tcl_FSMountsChanged, /* 480 */
Tcl_EvalTokensStandard, /* 481 */
+ Tcl_GetTime, /* 482 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 995ed27..ca41034 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.32 2001/09/28 01:21:53 dgp Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.33 2001/11/21 02:36:20 hobbs Exp $
*/
#define TCL_TEST
@@ -3627,54 +3627,54 @@ GetTimesCmd(unused, interp, argc, argv)
/* alloc & free 100000 times */
fprintf(stderr, "alloc & free 100000 6 word items\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
objPtr = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj));
ckfree((char *) objPtr);
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per alloc+free\n", timePer/100000);
/* alloc 5000 times */
fprintf(stderr, "alloc 5000 6 word items\n");
objv = (Tcl_Obj **) ckalloc(5000 * sizeof(Tcl_Obj *));
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
objv[i] = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj));
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per alloc\n", timePer/5000);
/* free 5000 times */
fprintf(stderr, "free 5000 6 word items\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
ckfree((char *) objv[i]);
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per free\n", timePer/5000);
/* Tcl_NewObj 5000 times */
fprintf(stderr, "Tcl_NewObj 5000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
objv[i] = Tcl_NewObj();
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_NewObj\n", timePer/5000);
/* Tcl_DecrRefCount 5000 times */
fprintf(stderr, "Tcl_DecrRefCount 5000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 5000; i++) {
objPtr = objv[i];
Tcl_DecrRefCount(objPtr);
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_DecrRefCount\n", timePer/5000);
ckfree((char *) objv);
@@ -3682,24 +3682,24 @@ GetTimesCmd(unused, interp, argc, argv)
/* TclGetString 100000 times */
fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n");
objPtr = Tcl_NewStringObj("12345", -1);
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
(void) TclGetString(objPtr);
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per TclGetStringFromObj of \"12345\"\n",
timePer/100000);
/* Tcl_GetIntFromObj 100000 times */
fprintf(stderr, "Tcl_GetIntFromObj of \"12345\" 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
if (Tcl_GetIntFromObj(interp, objPtr, &n) != TCL_OK) {
return TCL_ERROR;
}
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_GetIntFromObj of \"12345\"\n",
timePer/100000);
@@ -3707,63 +3707,63 @@ GetTimesCmd(unused, interp, argc, argv)
/* Tcl_GetInt 100000 times */
fprintf(stderr, "Tcl_GetInt of \"12345\" 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
if (Tcl_GetInt(interp, "12345", &n) != TCL_OK) {
return TCL_ERROR;
}
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_GetInt of \"12345\"\n",
timePer/100000);
/* sprintf 100000 times */
fprintf(stderr, "sprintf of 12345 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
sprintf(newString, "%d", 12345);
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per sprintf of 12345\n",
timePer/100000);
/* hashtable lookup 100000 times */
fprintf(stderr, "hashtable lookup of \"gettimes\" 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
(void) Tcl_FindHashEntry(&iPtr->globalNsPtr->cmdTable, "gettimes");
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per hashtable lookup of \"gettimes\"\n",
timePer/100000);
/* Tcl_SetVar 100000 times */
fprintf(stderr, "Tcl_SetVar of \"12345\" 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
s = Tcl_SetVar(interp, "a", "12345", TCL_LEAVE_ERR_MSG);
if (s == NULL) {
return TCL_ERROR;
}
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_SetVar of a to \"12345\"\n",
timePer/100000);
/* Tcl_GetVar 100000 times */
fprintf(stderr, "Tcl_GetVar of a==\"12345\" 100000 times\n");
- TclpGetTime(&start);
+ Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
s = Tcl_GetVar(interp, "a", TCL_LEAVE_ERR_MSG);
if (s == NULL) {
return TCL_ERROR;
}
}
- TclpGetTime(&stop);
+ Tcl_GetTime(&stop);
timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec);
fprintf(stderr, " %.3f usec per Tcl_GetVar of a==\"12345\"\n",
timePer/100000);
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index 3397cb7..27e10d5 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTimer.c,v 1.3 1999/04/16 00:46:54 stanton Exp $
+ * RCS: @(#) $Id: tclTimer.c,v 1.4 2001/11/21 02:36:20 hobbs Exp $
*/
#include "tclInt.h"
@@ -224,7 +224,7 @@ Tcl_CreateTimerHandler(milliseconds, proc, clientData)
* Compute when the event should fire.
*/
- TclpGetTime(&time);
+ Tcl_GetTime(&time);
timerHandlerPtr->time.sec = time.sec + milliseconds/1000;
timerHandlerPtr->time.usec = time.usec + (milliseconds%1000)*1000;
if (timerHandlerPtr->time.usec >= 1000000) {
@@ -350,7 +350,7 @@ TimerSetupProc(data, flags)
* Compute the timeout for the next timer on the list.
*/
- TclpGetTime(&blockTime);
+ Tcl_GetTime(&blockTime);
blockTime.sec = tsdPtr->firstTimerHandlerPtr->time.sec - blockTime.sec;
blockTime.usec = tsdPtr->firstTimerHandlerPtr->time.usec -
blockTime.usec;
@@ -401,7 +401,7 @@ TimerCheckProc(data, flags)
* Compute the timeout for the next timer on the list.
*/
- TclpGetTime(&blockTime);
+ Tcl_GetTime(&blockTime);
blockTime.sec = tsdPtr->firstTimerHandlerPtr->time.sec - blockTime.sec;
blockTime.usec = tsdPtr->firstTimerHandlerPtr->time.usec -
blockTime.usec;
@@ -500,7 +500,7 @@ TimerHandlerEventProc(evPtr, flags)
tsdPtr->timerPending = 0;
currentTimerId = tsdPtr->lastTimerId;
- TclpGetTime(&time);
+ Tcl_GetTime(&time);
while (1) {
nextPtrPtr = &tsdPtr->firstTimerHandlerPtr;
timerHandlerPtr = tsdPtr->firstTimerHandlerPtr;
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 19f4850..11134be 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.25 2001/11/14 23:17:04 hobbs Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.26 2001/11/21 02:36:21 hobbs Exp $
*/
#include "tclInt.h"
@@ -2255,7 +2255,7 @@ TclGetIntForIndex(interp, objPtr, endValue, indexPtr)
*----------------------------------------------------------------------
*/
-void
+static void
UpdateStringOfEndOffset( objPtr )
register Tcl_Obj* objPtr;
{
@@ -2453,3 +2453,29 @@ Tcl_GetNameOfExecutable()
{
return (tclExecutableName);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclpGetTime --
+ *
+ * Deprecated synonym for Tcl_GetTime.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Stores current time in the buffer designated by "timePtr"
+ *
+ * This procedure is provided for the benefit of extensions written
+ * before Tcl_GetTime was exported from the library.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclpGetTime( timePtr )
+ Tcl_Time* timePtr;
+{
+ Tcl_GetTime( timePtr );
+}