From owner-freebsd-java@FreeBSD.ORG Tue Apr 12 04:17:37 2005 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBB0116A4CE for ; Tue, 12 Apr 2005 04:17:37 +0000 (GMT) Received: from mta6.srv.hcvlny.cv.net (mta6.srv.hcvlny.cv.net [167.206.4.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8480543D41 for ; Tue, 12 Apr 2005 04:17:37 +0000 (GMT) (envelope-from truk@optonline.net) Received: from [172.16.1.23] (ool-182e24b7.dyn.optonline.net [24.46.36.183]) by mta6.srv.hcvlny.cv.net (iPlanet Messaging Server 5.2 HotFix 1.25 (built Mar 3 2004)) with ESMTP id <0IET002SZFXHD4@mta6.srv.hcvlny.cv.net> for freebsd-java@freebsd.org; Tue, 12 Apr 2005 00:17:42 -0400 (EDT) Date: Mon, 11 Apr 2005 23:40:08 -0400 From: Kurt Miller In-reply-to: <002001c53f15$13594dd0$150110ac@focus> To: freebsd-java@freebsd.org, Christy Pang Message-id: <425B4318.70005@optonline.net> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_tvbk+Aqq45W1Qn+yg7HFGg)" X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050408) References: <002001c53f15$13594dd0$150110ac@focus> Subject: Re:TimeZone Defaults] X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2005 04:17:38 -0000 This is a multi-part message in MIME format. --Boundary_(ID_tvbk+Aqq45W1Qn+yg7HFGg) Content-type: text/plain; charset=iso-8859-1; format=flowed Content-transfer-encoding: 7BIT Kurt Miller wrote: > > ----- Original Message ----- From: "Christy Pang" > > To: "Kurt Miller" > Cc: > Sent: Monday, April 11, 2005 11:41 PM > Subject: Re: TimeZone Defaults] > > >> Kurt Miller wrote: >> >>> From: "Christy Pang" >>> >>>> Kurt Miller wrote: >>>> >>>>> Is /etc/localtime a symlink? If it is, try copying the tz file >>>>> to /etc/localtime instead. >>>> >>>> >>>> >>>> It was a symlink. Our /etc file system is a read only file system. >>>> But even copy the TZ file to /etc/localtime >>>> >>>> md5 /etc/localtime >>>> MD5 (/etc/localtime) = 370687bb78b74fc4540f6a316d8bca02 >>>> >>>> > root@sip-tey 2:24pm # md5 /usr/share/zoneinfo/America/Toronto >>>> MD5 (/usr/share/zoneinfo/America/Toronto) = >>>> 370687bb78b74fc4540f6a316d8bca02 >>> >>> >>> >>> Does copying America/Montreal to /etc/localtime work? >> >> >> >> YES!!! But why copy over America/Toronto does not work? >> >> Thanks >> Chriwty > America/Toronto is not recognized by the jdk (look in jre/lib/zi) so it falls back to using localtime(3). However the localtime code appears to have the GTM offset sign reversed. The attached patch should fix that and also allow you to use a symlink for /etc/localtime. -Kurt --Boundary_(ID_tvbk+Aqq45W1Qn+yg7HFGg) Content-type: text/plain; name="patch-java::util::TimeZone_md.c" Content-transfer-encoding: 7BIT Content-disposition: inline; filename="patch-java::util::TimeZone_md.c" $FreeBSD$ --- ../../j2se/src/solaris/native/java/util/TimeZone_md.c.orig Mon Apr 11 20:48:26 2005 +++ ../../j2se/src/solaris/native/java/util/TimeZone_md.c Mon Apr 11 20:50:06 2005 @@ -236,7 +236,7 @@ return NULL; } -#if defined(__linux__) +#if defined(__linux__) || defined(_BSD_SOURCE) /* * If it's a symlink, get the link name and its zone ID part. (The * older versions of timeconfig created a symlink as described in @@ -260,7 +260,7 @@ } return tz; } -#endif /* __linux__ */ +#endif /* __linux__ || _BSD_SOURCE */ /* * If it's a regular file, we need to find out the same zoneinfo file @@ -548,18 +548,17 @@ return strdup("GMT"); } - /* Note that the time offset direction is opposite. */ #if defined(_BSD_SOURCE) clock = time(NULL); tzset(); local_tm = localtime(&clock); - if (local_tm->tm_gmtoff > 0) { + if (local_tm->tm_gmtoff >= 0) { offset = (time_t) local_tm->tm_gmtoff; - sign = '-'; + sign = '+'; } else { offset = (time_t) -local_tm->tm_gmtoff; - sign = '+'; + sign = '-'; } #else if (timezone > 0) { --Boundary_(ID_tvbk+Aqq45W1Qn+yg7HFGg)--