Date: Thu, 14 Mar 2002 03:43:30 +1030 From: Greg Lewis <glewis@eyesbeyond.com> To: Stacy Millions <stacy@millions.ca> Cc: Timothy Kettering <timster@blackcore.com>, FreeBSD-Java <java@FreeBSD.ORG> Subject: Re: Setting the JVM timezone Message-ID: <20020314034330.A18304@misty.eyesbeyond.com> In-Reply-To: <3C8F6B9E.CA1AADBA@millions.ca>; from stacy@millions.ca on Wed, Mar 13, 2002 at 08:09:18AM -0700 References: <B8B44B38.583D%timster@blackcore.com> <3C8F6B9E.CA1AADBA@millions.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 13, 2002 at 08:09:18AM -0700, Stacy Millions wrote: > I tracked down (what I think is) the problem. > > In the file .../src/solaris/native/java/util/TimeZone_md.c > you will find the following (this is the original unpatched source) > > /* Note that the time offset direction is opposite. */ > if (timezone > 0) { > offset = timezone; > sign = '-'; > } else { > offset = -timezone; > sign = '+'; > } > > p6 turns it into: > > /* Note that the time offset direction is opposite. */ > #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) > || defined(__bsdi__) > struct tm *local_tm; > time_t clock = time(NULL); > tzset(); > local_tm = localtime(&clock); > if (local_tm->tm_gmtoff > 0) { > offset = (time_t) local_tm->tm_gmtoff; > sign = '-'; > } > else { > offset = (time_t) -local_tm->tm_gmtoff; > sign = '+'; > } > #else > if (timezone > 0) { > offset = timezone; > sign = '-'; > } else { > offset = -timezone; > sign = '+'; > } > #endif > > all I did was swap the '+' and '-' and the problem went away. > (see attached diff file) D'oh. Cut and pasto by yours truly it looks like. > Please note that I spent all of .5 hours looking at this (and less > testing it), so I don't know if this breaks something else. Thanks for the patch! I'll try and verify that this still DTRT for time zones both ahead and behind GMT. -- Greg Lewis Email : glewis@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020314034330.A18304>