From owner-freebsd-java Wed Mar 13 9:13:45 2002 Delivered-To: freebsd-java@freebsd.org Received: from mgr1.xmission.com (mgr1.xmission.com [198.60.22.201]) by hub.freebsd.org (Postfix) with ESMTP id E52B037B419 for ; Wed, 13 Mar 2002 09:13:37 -0800 (PST) Received: from [207.135.128.145] (helo=misty.eyesbeyond.com) by mgr1.xmission.com with esmtp (Exim 3.22 #1) id 16lCJj-0008Ou-00; Wed, 13 Mar 2002 10:13:36 -0700 Received: (from glewis@localhost) by misty.eyesbeyond.com (8.11.6/8.11.6) id g2DHDUC18329; Thu, 14 Mar 2002 03:43:30 +1030 (CST) (envelope-from glewis) Date: Thu, 14 Mar 2002 03:43:30 +1030 From: Greg Lewis To: Stacy Millions Cc: Timothy Kettering , FreeBSD-Java Subject: Re: Setting the JVM timezone Message-ID: <20020314034330.A18304@misty.eyesbeyond.com> References: <3C8F6B9E.CA1AADBA@millions.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3C8F6B9E.CA1AADBA@millions.ca>; from stacy@millions.ca on Wed, Mar 13, 2002 at 08:09:18AM -0700 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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