diff options
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | doc/GetTime.3 | 53 | ||||
-rw-r--r-- | generic/tcl.decls | 9 | ||||
-rw-r--r-- | generic/tclClock.c | 4 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 10 | ||||
-rw-r--r-- | generic/tclCompile.c | 6 | ||||
-rw-r--r-- | generic/tclDecls.h | 9 | ||||
-rw-r--r-- | generic/tclInt.decls | 5 | ||||
-rw-r--r-- | generic/tclInt.h | 3 | ||||
-rw-r--r-- | generic/tclStubInit.c | 3 | ||||
-rw-r--r-- | generic/tclTest.c | 50 | ||||
-rw-r--r-- | generic/tclTimer.c | 10 | ||||
-rw-r--r-- | generic/tclUtil.c | 30 | ||||
-rw-r--r-- | mac/tclMacNotify.c | 4 | ||||
-rw-r--r-- | mac/tclMacShLib.exp | 1 | ||||
-rw-r--r-- | mac/tclMacTime.c | 8 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 6 | ||||
-rw-r--r-- | unix/tclUnixEvent.c | 6 | ||||
-rw-r--r-- | unix/tclUnixThrd.c | 2 | ||||
-rw-r--r-- | unix/tclUnixTime.c | 6 | ||||
-rw-r--r-- | win/tclWinNotify.c | 6 | ||||
-rw-r--r-- | win/tclWinTest.c | 4 | ||||
-rw-r--r-- | win/tclWinTime.c | 12 |
23 files changed, 210 insertions, 76 deletions
@@ -1,3 +1,38 @@ +2001-11-20 Kevin B. Kenny <kennykb@users.sourceforge.net> + + * doc/GetTime.3 (Tcl_GetTime): + * generic/tcl.decls (Tcl_GetTime): + * generic/tclClock.c (Tcl_ClockObjCmd): + * generic/tclCompile.c (TclCleanupByteCode, TclInitByteCodeObj): + * generic/tclCmdMZ.c (Tcl_TimeObjCmd): + * generic/tclUtil.c (TclpGetTime): + * generic/tclTest.c (GetTimesCmd): + * generic/tclTimer.c (Tcl_CreateTimerHandler, TimerSetupProc, + TimerCheckProc, TimerHandlerEventProc): + * mac/tclMacNotify.c (Tcl_SetTimer): + * mac/tclMacShLib.exp (Tcl_GetTime): + * mac/tclMacTime.c (Tcl_GetTime): + * unix/tclUnixChan.c (TclUnixWaitForFile): + * unix/tclUnixEvent.c (Tcl_Sleep): + * unix/tclUnixThrd.c (Tcl_ConditionWait): + * unix/tclUnixTime.c (Tcl_GetTime): + * win/tclWinNotify.c (Tcl_Sleep): + * win/tclWinTest.c (TestwinclockCmd): + * win/tclWinTime.c (TclpGetSeconds, TclpGetClicks, Tcl_GetTime): + Changed all uses of TclpGetTime to Tcl_GetTime. Added Tcl_GetTime + to the Stubs table and the library documentation. Added a + TclpGetTime in tclUtil.c for backward compatibility of + extensions. [Patch #483500, TIP#73] + + * generic/tclCmdMZ.c (Tcl_TimeObjCmd): Corrected an error in the + [time] command that caused incorrect results to be returned if the + total duration of all iterations exceeded 2**31 microseconds. + [Bug #478847] + + * generic/tclInt.decls: + * generic/tclInt.h: + * generic/tclStubInit.h: Reran 'make genstubs' + 2001-11-20 Miguel Sofer <msofer@users.sourceforge.net> * generic/tclBasic.c @@ -40,6 +75,10 @@ 2001-11-20 Jeff Hobbs <jeffh@ActiveState.com> + * tools/eolFix.tcl (new-file): + * unix/Makefile.in: added EOL correction for Windows bat files to + dist target. [Bug #219409] (davygrvy) + * unix/tclUnixInit.c (TclpSetInitialEncodings): update of patch from 2001-11-16 that uses the old Tcl encoding check mechanism as a fallback to the original. Also added a TCL_DEFAULT_ENCODING diff --git a/doc/GetTime.3 b/doc/GetTime.3 new file mode 100644 index 0000000..f72175f --- /dev/null +++ b/doc/GetTime.3 @@ -0,0 +1,53 @@ +'\" +'\" Copyright (c) 2001 by Kevin B. Kenny. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +'\" RCS: @(#) $Id$ +'\" +.so man.macros +.TH Tcl_GetTime 3 8.4 Tcl "Tcl Library Procedures" +.BS +.SH NAME +Tcl_GetTime \- get date and time +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_GetTime\fR(\fI timePtr \fR) +.SH ARGUMENTS +.AS "Tcl_Time *" timePtr +.AP "Tcl_Time *" timePtr out +Points to memory in which to store the date and time information. +.BE +.SH DESCRIPTION +.PP +The \fBTcl_GetTime\fR function retrieves the current time as a +\fITcl_Time\fR structure in memory the caller provides. This +structure has the following definition: +.CS +typedef struct Tcl_Time { + long sec; + long usec; +} Tcl_Time; +.CE +.PP +On return, the \fIsec\fR member of the structure is filled in with the +number of seconds that have elapsed since the \fIepoch:\fR the epoch +is the point in time of 00:00 UTC, 1 January 1970. This number does +\fInot\fR count leap seconds \- an interval of one day advances it by +86400 seconds regardless of whether a leap second has been inserted. +.PP +The \fIusec\fR member of the structure is filled in with the number of +microseconds that have elapsed since the start of the second +designated by \fIsec\fR. The Tcl library makes every effort to keep +this number as precise as possible, subject to the limitations of the +computer system. On multiprocessor variants of Windows, this number +may be limited to the 10- or 20-ms granularity of the system clock. +(On single-processor Windows systems, the \fIusec\fR field is derived +from a performance counter and is highly precise.) +.SH "SEE ALSO" +clock +.SH KEYWORDS +date, time 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 ); +} diff --git a/mac/tclMacNotify.c b/mac/tclMacNotify.c index 93820ba..50844cd 100644 --- a/mac/tclMacNotify.c +++ b/mac/tclMacNotify.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacNotify.c,v 1.6 1999/08/10 04:21:40 jingham Exp $ + * RCS: @(#) $Id: tclMacNotify.c,v 1.7 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclInt.h" @@ -351,7 +351,7 @@ Tcl_SetTimer( * Compute when the timer should fire. */ - TclpGetTime(¬ifier.timer); + Tcl_GetTime(¬ifier.timer); notifier.timer.sec += timePtr->sec; notifier.timer.usec += timePtr->usec; if (notifier.timer.usec >= 1000000) { diff --git a/mac/tclMacShLib.exp b/mac/tclMacShLib.exp index 8ada490..9689ccd 100644 --- a/mac/tclMacShLib.exp +++ b/mac/tclMacShLib.exp @@ -510,6 +510,7 @@ Tcl_GetSlave Tcl_GetStdChannel Tcl_GetStringFromObj Tcl_GetStringResult +Tcl_GetTime Tcl_GetVar Tcl_GetVar2 Tcl_GetVariableFullName diff --git a/mac/tclMacTime.c b/mac/tclMacTime.c index 25bf08e..1fc1231 100644 --- a/mac/tclMacTime.c +++ b/mac/tclMacTime.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: tclMacTime.c,v 1.4 2001/07/31 19:12:07 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacTime.c,v 1.5 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclInt.h" @@ -19,7 +19,7 @@ #include <time.h> /* - * Static variables used by the TclpGetTime function. + * Static variables used by the Tcl_GetTime function. */ static int initalized = false; @@ -173,7 +173,7 @@ TclpGetTimeZone ( /* *---------------------------------------------------------------------- * - * TclpGetTime -- + * Tcl_GetTime -- * * Gets the current system time in seconds and microseconds * since the beginning of the epoch: 00:00 UCT, January 1, 1970. @@ -188,7 +188,7 @@ TclpGetTimeZone ( */ void -TclpGetTime( +Tcl_GetTime( Tcl_Time *timePtr) /* Location to store time information. */ { UnsignedWide micro; diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index dbdf453..23bb599 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -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: tclUnixChan.c,v 1.22 2001/10/25 15:50:49 dkf Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.23 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -2706,7 +2706,7 @@ TclUnixWaitForFile(fd, mask, timeout) */ if (timeout > 0) { - TclpGetTime(&now); + Tcl_GetTime(&now); abortTime.sec = now.sec + timeout/1000; abortTime.usec = now.usec + (timeout%1000)*1000; if (abortTime.usec >= 1000000) { @@ -2796,7 +2796,7 @@ TclUnixWaitForFile(fd, mask, timeout) * The select returned early, so we need to recompute the timeout. */ - TclpGetTime(&now); + Tcl_GetTime(&now); if ((abortTime.sec < now.sec) || ((abortTime.sec == now.sec) && (abortTime.usec <= now.usec))) { diff --git a/unix/tclUnixEvent.c b/unix/tclUnixEvent.c index 00371b5..a623dbb 100644 --- a/unix/tclUnixEvent.c +++ b/unix/tclUnixEvent.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: tclUnixEvent.c,v 1.3 1999/04/16 00:48:04 stanton Exp $ + * RCS: @(#) $Id: tclUnixEvent.c,v 1.4 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclInt.h" @@ -44,7 +44,7 @@ Tcl_Sleep(ms) * early, go back to sleep again. */ - TclpGetTime(&before); + Tcl_GetTime(&before); after = before; after.sec += ms/1000; after.usec += (ms%1000)*1000; @@ -71,6 +71,6 @@ Tcl_Sleep(ms) } (void) select(0, (SELECT_MASK *) 0, (SELECT_MASK *) 0, (SELECT_MASK *) 0, &delay); - TclpGetTime(&before); + Tcl_GetTime(&before); } } diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index faf08ed..ccffe3a 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -688,7 +688,7 @@ Tcl_ConditionWait(condPtr, mutexPtr, timePtr) * current time, including possible overflow situations. [Bug #411603] */ - TclpGetTime(&now); + Tcl_GetTime(&now); ptime.tv_sec = timePtr->sec + now.sec + (timePtr->usec + now.usec) / 1000000; ptime.tv_nsec = 1000 * ((timePtr->usec + now.usec) % 1000000); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index d3235b1..8047858 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.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: tclUnixTime.c,v 1.11 2001/04/10 18:32:39 kennykb Exp $ + * RCS: @(#) $Id: tclUnixTime.c,v 1.12 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclInt.h" @@ -240,7 +240,7 @@ TclpGetTimeZone (currentTime) /* *---------------------------------------------------------------------- * - * TclpGetTime -- + * Tcl_GetTime -- * * Gets the current system time in seconds and microseconds * since the beginning of the epoch: 00:00 UCT, January 1, 1970. @@ -255,7 +255,7 @@ TclpGetTimeZone (currentTime) */ void -TclpGetTime(timePtr) +Tcl_GetTime(timePtr) Tcl_Time *timePtr; /* Location to store time information. */ { struct timeval tv; diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index eb33ed2..d788086 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.c @@ -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: tclWinNotify.c,v 1.8 2001/09/20 18:34:22 hobbs Exp $ + * RCS: @(#) $Id: tclWinNotify.c,v 1.9 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclWinInt.h" @@ -521,7 +521,7 @@ Tcl_Sleep(ms) Tcl_Time desired; /* Desired wakeup time */ int sleepTime = ms; /* Time to sleep */ - TclpGetTime( &now ); + Tcl_GetTime( &now ); desired.sec = now.sec + ( ms / 1000 ); desired.usec = now.usec + 1000 * ( ms % 1000 ); if ( desired.usec > 1000000 ) { @@ -531,7 +531,7 @@ Tcl_Sleep(ms) for ( ; ; ) { Sleep( sleepTime ); - TclpGetTime( &now ); + Tcl_GetTime( &now ); if ( now.sec > desired.sec ) { break; } else if ( ( now.sec == desired.sec ) diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 8d290a8..6a6825c 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.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: tclWinTest.c,v 1.5 2000/11/21 21:33:43 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.6 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclWinInt.h" @@ -244,7 +244,7 @@ TestwinclockCmd( ClientData dummy, return TCL_ERROR; } - TclpGetTime( &tclTime ); + Tcl_GetTime( &tclTime ); GetSystemTimeAsFileTime( &sysTime ); t1.LowPart = posixEpoch.dwLowDateTime; t1.HighPart = posixEpoch.dwHighDateTime; diff --git a/win/tclWinTime.c b/win/tclWinTime.c index d12afdf..d90e8ba 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.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: tclWinTime.c,v 1.8 2001/09/06 11:48:44 davygrvy Exp $ + * RCS: @(#) $Id: tclWinTime.c,v 1.9 2001/11/21 02:36:21 hobbs Exp $ */ #include "tclWinInt.h" @@ -131,7 +131,7 @@ unsigned long TclpGetSeconds() { Tcl_Time t; - TclpGetTime( &t ); + Tcl_GetTime( &t ); return t.sec; } @@ -159,14 +159,14 @@ unsigned long TclpGetClicks() { /* - * Use the TclpGetTime abstraction to get the time in microseconds, + * Use the Tcl_GetTime abstraction to get the time in microseconds, * as nearly as we can, and return it. */ Tcl_Time now; /* Current Tcl time */ unsigned long retval; /* Value to return */ - TclpGetTime( &now ); + Tcl_GetTime( &now ); retval = ( now.sec * 1000000 ) + now.usec; return retval; @@ -205,7 +205,7 @@ TclpGetTimeZone (currentTime) /* *---------------------------------------------------------------------- * - * TclpGetTime -- + * Tcl_GetTime -- * * Gets the current system time in seconds and microseconds * since the beginning of the epoch: 00:00 UCT, January 1, 1970. @@ -226,7 +226,7 @@ TclpGetTimeZone (currentTime) */ void -TclpGetTime(timePtr) +Tcl_GetTime(timePtr) Tcl_Time *timePtr; /* Location to store time information. */ { |