Subject: Re: mysql NOW() bug on Alpha?
To: Dave Huang <khym@bga.com>
From: Simon Burge <simonb@wasabisystems.com>
List: port-alpha
Date: 10/07/2000 00:19:34
Dave Huang wrote:

> On Fri, 6 Oct 2000, Dave Huang wrote:
> > Hmm, interesting... I bet it has to do with negative timezone offsets...
> > if I link /etc/localtime to GMT or Australia, it works, but US doesn't.
> 
> Yeah, that does seem to be the problem... when loading in the timezone
> info, it's stuffing the GMT offset into a 64-bit long rather than 32-bit
> int, so negative offsets are being treated as huge positive offsets. The
> patch below seems to fix the problem for me... perhaps the mysql-server
> package should be updated to use a more recent pthreads package rather
> than the one that comes with mysql? (devel/pth perhaps? or
> devel/unproven-pthreads? I dunno what the difference is between 'em :)

Good catch Dave!

One comment, shouldn't the "result" var in the detzcode() function
also be a "int32_t"?

> --- mit-pthreads/gen/ctime.c.orig	Sun Oct 12 07:07:41 1997
> +++ mit-pthreads/gen/ctime.c	Fri Oct  6 08:07:31 2000
> @@ -129,7 +129,7 @@
>  ** Prototypes for static functions.
>  */
>  
> -static long			detzcode __P_((const char *));
> +static int32_t			detzcode __P_((const char *));
>  static const char *	getnum __P_((const char *, int *, int, int));
>  static const char *	getsecs __P_((const char *, long *));
>  static const char *	getoffset __P_((const char *, long *));
> @@ -175,7 +175,7 @@
>  time_t			altzone = 0;
>  #endif /* defined ALTZONE */
>  
> -static long detzcode(const char * codep)
> +static int32_t detzcode(const char * codep)
>  {
>  	long result;
>  	int	i;
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Sales, Support and Service:  http://www.wasabisystems.com/