summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--generic/tclClock.c26
-rw-r--r--generic/tclDate.c12
-rw-r--r--generic/tclGetDate.y12
-rw-r--r--generic/tclInt.decls8
-rw-r--r--generic/tclIntDecls.h12
-rw-r--r--unix/tclUnixTime.c4
-rw-r--r--win/tclWinTime.c4
8 files changed, 51 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index a0a4fa6..012078b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-03-15 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tclClock.c:
+ * generic/tclDate.c:
+ * generic/tclGetDate.y:
+ * generic/tclInt.decls:
+ * unix/tclUnixTime.c:
+ * win/tclWinTime.c: Replaced 'unsigned long' variable holding
+ times with 'Tcl_WideInt', to cope with systems on which a time_t
+ is wider than a long (Win64) [Bug 1163422]
+ * generic/tclIntDecls.h: Regen
+
2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
* unix/tcl.m4: Make it work on OpenBSD again. Imported patch
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 9683abb..d476795 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.20.2.1 2004/05/14 21:41:11 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.20.2.2 2005/03/15 16:29:53 kennykb Exp $
*/
#include "tcl.h"
@@ -29,7 +29,7 @@ TCL_DECLARE_MUTEX(clockMutex)
*/
static int FormatClock _ANSI_ARGS_((Tcl_Interp *interp,
- unsigned long clockVal, int useGMT,
+ Tcl_WideInt clockVal, int useGMT,
char *format));
/*
@@ -62,7 +62,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
int useGMT = 0;
char *format = "%a %b %d %X %Z %Y";
int dummy;
- unsigned long baseClock, clockVal;
+ Tcl_WideInt baseClock, clockVal;
long zone;
Tcl_Obj *baseObjPtr = NULL;
char *scanStr;
@@ -128,7 +128,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[2], (long*) &clockVal)
+ if (Tcl_GetWideIntFromObj(interp, objv[2], &clockVal)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -157,7 +157,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
if (objc != 0) {
goto wrongFmtArgs;
}
- return FormatClock(interp, (unsigned long) clockVal, useGMT,
+ return FormatClock(interp, clockVal, useGMT,
format);
case COMMAND_SCAN: /* scan */
@@ -194,8 +194,8 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
}
if (baseObjPtr != NULL) {
- if (Tcl_GetLongFromObj(interp, baseObjPtr,
- (long*) &baseClock) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, baseObjPtr,
+ &baseClock) != TCL_OK) {
return TCL_ERROR;
}
} else {
@@ -205,13 +205,13 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
if (useGMT) {
zone = -50000; /* Force GMT */
} else {
- zone = TclpGetTimeZone((unsigned long) baseClock);
+ zone = TclpGetTimeZone(baseClock);
}
scanStr = Tcl_GetStringFromObj(objv[2], &dummy);
Tcl_MutexLock(&clockMutex);
- if (TclGetDate(scanStr, (unsigned long) baseClock, zone,
- (unsigned long *) &clockVal) < 0) {
+ if (TclGetDate(scanStr, baseClock, zone,
+ &clockVal) < 0) {
Tcl_MutexUnlock(&clockMutex);
Tcl_AppendStringsToObj(resultPtr,
"unable to convert date-time string \"",
@@ -220,7 +220,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
}
Tcl_MutexUnlock(&clockMutex);
- Tcl_SetLongObj(resultPtr, (long) clockVal);
+ Tcl_SetWideIntObj(resultPtr, clockVal);
return TCL_OK;
case COMMAND_SECONDS: /* seconds */
@@ -255,7 +255,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
static int
FormatClock(interp, clockVal, useGMT, format)
Tcl_Interp *interp; /* Current interpreter. */
- unsigned long clockVal; /* Time in seconds. */
+ Tcl_WideInt clockVal; /* Time in seconds. */
int useGMT; /* Boolean */
char *format; /* Format string */
{
@@ -317,7 +317,7 @@ FormatClock(interp, clockVal, useGMT, format)
}
#endif
- tclockVal = clockVal;
+ tclockVal = (time_t) clockVal;
timeDataPtr = TclpGetDate((TclpTime_t) &tclockVal, useGMT);
/*
diff --git a/generic/tclDate.c b/generic/tclDate.c
index 31576d2..870988f 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.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: tclDate.c,v 1.20 2001/10/18 20:20:28 hobbs Exp $
+ * RCS: @(#) $Id: tclDate.c,v 1.20.4.1 2005/03/15 16:29:53 kennykb Exp $
*/
#include "tclInt.h"
@@ -832,9 +832,9 @@ TclDatelex()
int
TclGetDate(p, now, zone, timePtr)
char *p;
- unsigned long now;
+ Tcl_WideInt now;
long zone;
- unsigned long *timePtr;
+ Tcl_WideInt *timePtr;
{
struct tm *tm;
time_t Start;
@@ -844,8 +844,8 @@ TclGetDate(p, now, zone, timePtr)
TclDateInput = p;
/* now has to be cast to a time_t for 64bit compliance */
- Start = now;
- tm = TclpGetDate((TclpTime_t) &Start, 0);
+ Start = (time_t) now;
+ tm = TclpGetDate((TclpTime_t) &Start, (zone == -50000));
thisyear = tm->tm_year + TM_YEAR_BASE;
TclDateYear = thisyear;
TclDateMonth = tm->tm_mon + 1;
@@ -904,7 +904,7 @@ TclGetDate(p, now, zone, timePtr)
return -1;
}
} else {
- Start = now;
+ Start = (time_t) now;
if (!TclDateHaveRel) {
Start -= ((tm->tm_hour * 60L * 60L) +
tm->tm_min * 60L) + tm->tm_sec;
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 14b9869..62a70c8 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -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: tclGetDate.y,v 1.18 2001/10/18 20:20:28 hobbs Exp $
+ * RCS: @(#) $Id: tclGetDate.y,v 1.18.4.1 2005/03/15 16:29:53 kennykb Exp $
*/
%{
@@ -1051,9 +1051,9 @@ yylex()
int
TclGetDate(p, now, zone, timePtr)
char *p;
- unsigned long now;
+ Tcl_WideInt now;
long zone;
- unsigned long *timePtr;
+ Tcl_WideInt *timePtr;
{
struct tm *tm;
time_t Start;
@@ -1063,8 +1063,8 @@ TclGetDate(p, now, zone, timePtr)
yyInput = p;
/* now has to be cast to a time_t for 64bit compliance */
- Start = now;
- tm = TclpGetDate((TclpTime_t) &Start, 0);
+ Start = (time_t) now;
+ tm = TclpGetDate((TclpTime_t) &Start, (zone == -50000));
thisyear = tm->tm_year + TM_YEAR_BASE;
yyYear = thisyear;
yyMonth = tm->tm_mon + 1;
@@ -1123,7 +1123,7 @@ TclGetDate(p, now, zone, timePtr)
return -1;
}
} else {
- Start = now;
+ Start = (time_t) now;
if (!yyHaveRel) {
Start -= ((tm->tm_hour * 60L * 60L) +
tm->tm_min * 60L) + tm->tm_sec;
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 71434b5..82d5e49 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.59.2.5 2004/10/28 16:06:32 kennykb Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.59.2.6 2005/03/15 16:29:53 kennykb Exp $
library tcl
@@ -124,8 +124,8 @@ declare 25 generic {
# char * TclGetCwd(Tcl_Interp *interp)
# }
declare 27 generic {
- int TclGetDate(char *p, unsigned long now, long zone,
- unsigned long *timePtr)
+ int TclGetDate(char *p, Tcl_WideInt now, long zone,
+ Tcl_WideInt *timePtr)
}
declare 28 generic {
Tcl_Channel TclpGetDefaultStdChannel(int type)
@@ -312,7 +312,7 @@ declare 77 generic {
}
declare 78 generic {
- int TclpGetTimeZone(unsigned long time)
+ int TclpGetTimeZone(Tcl_WideInt time)
}
# Replaced by Tcl_FSListVolumes in 8.4:
#declare 79 generic {
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index e70baf1..c761ae1 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -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: tclIntDecls.h,v 1.49.2.7 2004/10/28 16:06:33 kennykb Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.49.2.8 2005/03/15 16:29:53 kennykb Exp $
*/
#ifndef _TCLINTDECLS
@@ -115,8 +115,8 @@ EXTERN int TclFormatInt _ANSI_ARGS_((char * buffer, long n));
EXTERN void TclFreePackageInfo _ANSI_ARGS_((Interp * iPtr));
/* Slot 26 is reserved */
/* 27 */
-EXTERN int TclGetDate _ANSI_ARGS_((char * p, unsigned long now,
- long zone, unsigned long * timePtr));
+EXTERN int TclGetDate _ANSI_ARGS_((char * p, Tcl_WideInt now,
+ long zone, Tcl_WideInt * timePtr));
/* 28 */
EXTERN Tcl_Channel TclpGetDefaultStdChannel _ANSI_ARGS_((int type));
/* Slot 29 is reserved */
@@ -241,7 +241,7 @@ EXTERN unsigned long TclpGetSeconds _ANSI_ARGS_((void));
/* 77 */
EXTERN void TclpGetTime _ANSI_ARGS_((Tcl_Time * time));
/* 78 */
-EXTERN int TclpGetTimeZone _ANSI_ARGS_((unsigned long time));
+EXTERN int TclpGetTimeZone _ANSI_ARGS_((Tcl_WideInt time));
/* Slot 79 is reserved */
/* Slot 80 is reserved */
/* 81 */
@@ -580,7 +580,7 @@ typedef struct TclIntStubs {
int (*tclFormatInt) _ANSI_ARGS_((char * buffer, long n)); /* 24 */
void (*tclFreePackageInfo) _ANSI_ARGS_((Interp * iPtr)); /* 25 */
void *reserved26;
- int (*tclGetDate) _ANSI_ARGS_((char * p, unsigned long now, long zone, unsigned long * timePtr)); /* 27 */
+ int (*tclGetDate) _ANSI_ARGS_((char * p, Tcl_WideInt now, long zone, Tcl_WideInt * timePtr)); /* 27 */
Tcl_Channel (*tclpGetDefaultStdChannel) _ANSI_ARGS_((int type)); /* 28 */
void *reserved29;
void *reserved30;
@@ -631,7 +631,7 @@ typedef struct TclIntStubs {
unsigned long (*tclpGetClicks) _ANSI_ARGS_((void)); /* 75 */
unsigned long (*tclpGetSeconds) _ANSI_ARGS_((void)); /* 76 */
void (*tclpGetTime) _ANSI_ARGS_((Tcl_Time * time)); /* 77 */
- int (*tclpGetTimeZone) _ANSI_ARGS_((unsigned long time)); /* 78 */
+ int (*tclpGetTimeZone) _ANSI_ARGS_((Tcl_WideInt time)); /* 78 */
void *reserved79;
void *reserved80;
char * (*tclpRealloc) _ANSI_ARGS_((char * ptr, unsigned int size)); /* 81 */
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 0e0268f..da03440 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.15.2.3 2004/10/28 16:06:50 kennykb Exp $
+ * RCS: @(#) $Id: tclUnixTime.c,v 1.15.2.4 2005/03/15 16:29:54 kennykb Exp $
*/
#include "tclInt.h"
@@ -131,7 +131,7 @@ TclpGetClicks()
int
TclpGetTimeZone (currentTime)
- unsigned long currentTime;
+ Tcl_WideInt currentTime;
{
/*
* We prefer first to use the time zone in "struct tm" if the
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 0eb21b3..5696ffc 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.14.2.6 2004/10/28 16:06:51 kennykb Exp $
+ * RCS: @(#) $Id: tclWinTime.c,v 1.14.2.7 2005/03/15 16:29:55 kennykb Exp $
*/
#include "tclWinInt.h"
@@ -223,7 +223,7 @@ TclpGetClicks()
int
TclpGetTimeZone (currentTime)
- unsigned long currentTime;
+ Tcl_WideInt currentTime;
{
int timeZone;