fix issue with tcl time/date library
this seems to be an issue with conflocting behaviour of different tcl library versions
This commit is contained in:
10
tclDate.c
10
tclDate.c
@ -117,7 +117,7 @@ static int LookupWord _ANSI_ARGS_((char *buff));
|
|||||||
static int TclDatelex _ANSI_ARGS_((void));
|
static int TclDatelex _ANSI_ARGS_((void));
|
||||||
|
|
||||||
int
|
int
|
||||||
TclDateparse _ANSI_ARGS_((void));
|
TclDateparseX _ANSI_ARGS_((void));
|
||||||
typedef union
|
typedef union
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
YYSTYPE
|
YYSTYPE
|
||||||
@ -161,7 +161,7 @@ extern "C" {
|
|||||||
#ifndef TclDatelex
|
#ifndef TclDatelex
|
||||||
int TclDatelex(void);
|
int TclDatelex(void);
|
||||||
#endif
|
#endif
|
||||||
int TclDateparse(void);
|
int TclDateparseX(void);
|
||||||
#if defined(__cplusplus) && defined(__EXTERN_C__)
|
#if defined(__cplusplus) && defined(__EXTERN_C__)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -877,7 +877,7 @@ TclGetDate(p, now, zone, timePtr)
|
|||||||
TclDateHaveTime = 0;
|
TclDateHaveTime = 0;
|
||||||
TclDateHaveZone = 0;
|
TclDateHaveZone = 0;
|
||||||
|
|
||||||
if (TclDateparse() || TclDateHaveTime > 1 || TclDateHaveZone > 1 || TclDateHaveDate > 1 ||
|
if (TclDateparseX() || TclDateHaveTime > 1 || TclDateHaveZone > 1 || TclDateHaveDate > 1 ||
|
||||||
TclDateHaveDay > 1 || TclDateHaveOrdinalMonth > 1) {
|
TclDateHaveDay > 1 || TclDateHaveOrdinalMonth > 1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1231,9 +1231,9 @@ int TclDatecvtok(i) int i;
|
|||||||
** TclDateparse - return 0 if worked, 1 if syntax error not recovered from
|
** TclDateparse - return 0 if worked, 1 if syntax error not recovered from
|
||||||
*/
|
*/
|
||||||
#if defined(__STDC__) || defined(__cplusplus)
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
int TclDateparse(void)
|
int TclDateparseX(void)
|
||||||
#else
|
#else
|
||||||
int TclDateparse()
|
int TclDateparseX()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
register YYSTYPE *TclDatepvt = 0; /* top of value stack for $vars */
|
register YYSTYPE *TclDatepvt = 0; /* top of value stack for $vars */
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#define TM_YEAR_BASE 1900
|
#define TM_YEAR_BASE 1900
|
||||||
#define IsLeapYear(x) ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0))
|
#define IsLeapYear(x) ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0))
|
||||||
|
|
||||||
|
/* added declarations */
|
||||||
|
struct tm * TclpLocaltimeX( CONST time_t *tt);
|
||||||
|
struct tm * TclpGmtimeX( CONST time_t *tt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TclpGetDate is coded to return a pointer to a 'struct tm'. For
|
* TclpGetDate is coded to return a pointer to a 'struct tm'. For
|
||||||
* thread safety, this structure must be in thread-specific data.
|
* thread safety, this structure must be in thread-specific data.
|
||||||
@ -67,7 +71,7 @@ static void CleanupMemory _ANSI_ARGS_((ClientData));
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
TclpGetSeconds()
|
TclpGetSecondsX()
|
||||||
{
|
{
|
||||||
return time((time_t *) NULL);
|
return time((time_t *) NULL);
|
||||||
}
|
}
|
||||||
@ -92,7 +96,7 @@ TclpGetSeconds()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
TclpGetClicks()
|
TclpGetClicksX()
|
||||||
{
|
{
|
||||||
unsigned long now;
|
unsigned long now;
|
||||||
#ifdef NO_GETTOD
|
#ifdef NO_GETTOD
|
||||||
@ -131,7 +135,7 @@ TclpGetClicks()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
TclpGetTimeZone (currentTime)
|
TclpGetTimeZoneX (currentTime)
|
||||||
unsigned long currentTime;
|
unsigned long currentTime;
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -150,7 +154,7 @@ TclpGetTimeZone (currentTime)
|
|||||||
/* Struct tm contains tm_tzadj - that value may be used. */
|
/* Struct tm contains tm_tzadj - that value may be used. */
|
||||||
|
|
||||||
time_t curTime = (time_t) currentTime;
|
time_t curTime = (time_t) currentTime;
|
||||||
struct tm *timeDataPtr = TclpLocaltime((time_t *) &curTime);
|
struct tm *timeDataPtr = TclpLocaltimeX((time_t *) &curTime);
|
||||||
int timeZone;
|
int timeZone;
|
||||||
|
|
||||||
timeZone = timeDataPtr->tm_tzadj / 60;
|
timeZone = timeDataPtr->tm_tzadj / 60;
|
||||||
@ -168,7 +172,7 @@ TclpGetTimeZone (currentTime)
|
|||||||
/* Struct tm contains tm_gmtoff - that value may be used. */
|
/* Struct tm contains tm_gmtoff - that value may be used. */
|
||||||
|
|
||||||
time_t curTime = (time_t) currentTime;
|
time_t curTime = (time_t) currentTime;
|
||||||
struct tm *timeDataPtr = TclpLocaltime((time_t *) &curTime);
|
struct tm *timeDataPtr = TclpLocaltimeX((time_t *) &curTime);
|
||||||
int timeZone;
|
int timeZone;
|
||||||
|
|
||||||
timeZone = -(timeDataPtr->tm_gmtoff / 60);
|
timeZone = -(timeDataPtr->tm_gmtoff / 60);
|
||||||
@ -209,7 +213,7 @@ TclpGetTimeZone (currentTime)
|
|||||||
time_t tt;
|
time_t tt;
|
||||||
struct tm *stm;
|
struct tm *stm;
|
||||||
tt = 849268800L; /* 1996-11-29 12:00:00 GMT */
|
tt = 849268800L; /* 1996-11-29 12:00:00 GMT */
|
||||||
stm = TclpLocaltime((time_t *) &tt); /* eg 1996-11-29 6:00:00 CST6CDT */
|
stm = TclpLocaltimeX((time_t *) &tt); /* eg 1996-11-29 6:00:00 CST6CDT */
|
||||||
/* The calculation below assumes a max of +12 or -12 hours from GMT */
|
/* The calculation below assumes a max of +12 or -12 hours from GMT */
|
||||||
timeZone = (12 - stm->tm_hour)*60 + (0 - stm->tm_min);
|
timeZone = (12 - stm->tm_hour)*60 + (0 - stm->tm_min);
|
||||||
if ( stm -> tm_isdst ) {
|
if ( stm -> tm_isdst ) {
|
||||||
@ -247,7 +251,7 @@ TclpGetTimeZone (currentTime)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Tcl_GetTime(timePtr)
|
Tcl_GetTimeX(timePtr)
|
||||||
Tcl_Time *timePtr; /* Location to store time information. */
|
Tcl_Time *timePtr; /* Location to store time information. */
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -282,9 +286,9 @@ TclppGetDate(time, useGMT)
|
|||||||
{
|
{
|
||||||
time_t mtime = time;
|
time_t mtime = time;
|
||||||
if (useGMT) {
|
if (useGMT) {
|
||||||
return TclpGmtime(&mtime);
|
return TclpGmtimeX(&mtime);
|
||||||
} else {
|
} else {
|
||||||
return TclpLocaltime(&mtime);
|
return TclpLocaltimeX(&mtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +348,7 @@ TclpStrftime(s, maxsize, format, t, useGMT)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct tm *
|
struct tm *
|
||||||
TclpGmtime( tt )
|
TclpGmtimeX( tt )
|
||||||
CONST time_t *tt;
|
CONST time_t *tt;
|
||||||
{
|
{
|
||||||
CONST time_t *timePtr = (CONST time_t *) tt;
|
CONST time_t *timePtr = (CONST time_t *) tt;
|
||||||
@ -374,7 +378,7 @@ struct tm*
|
|||||||
TclpGmtime_unix( timePtr )
|
TclpGmtime_unix( timePtr )
|
||||||
CONST time_t *timePtr;
|
CONST time_t *timePtr;
|
||||||
{
|
{
|
||||||
return TclpGmtime( timePtr );
|
return TclpGmtimeX( timePtr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -395,7 +399,7 @@ TclpGmtime_unix( timePtr )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct tm *
|
struct tm *
|
||||||
TclpLocaltime( tt )
|
TclpLocaltimeX( tt )
|
||||||
CONST time_t *tt;
|
CONST time_t *tt;
|
||||||
{
|
{
|
||||||
CONST time_t *timePtr = (CONST time_t *) tt;
|
CONST time_t *timePtr = (CONST time_t *) tt;
|
||||||
@ -425,7 +429,7 @@ struct tm*
|
|||||||
TclpLocaltime_unix( timePtr )
|
TclpLocaltime_unix( timePtr )
|
||||||
CONST time_t *timePtr;
|
CONST time_t *timePtr;
|
||||||
{
|
{
|
||||||
return TclpLocaltime( timePtr );
|
return TclpLocaltimeX( timePtr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user