Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Apr 2005 23:40:08 -0400
From:      Kurt Miller <truk@optonline.net>
To:        freebsd-java@freebsd.org, Christy Pang <christy@borderware.com>
Subject:   Re:TimeZone Defaults]
Message-ID:  <425B4318.70005@optonline.net>
In-Reply-To: <002001c53f15$13594dd0$150110ac@focus>
References:  <002001c53f15$13594dd0$150110ac@focus>

next in thread | previous in thread | raw e-mail | index | archive | help
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" 
> <christy@borderware.com>
> To: "Kurt Miller" <truk@optonline.net>
> Cc: <freebsd-java@freebsd.org>
> Sent: Monday, April 11, 2005 11:41 PM
> Subject: Re: TimeZone Defaults]
>
>
>> Kurt Miller wrote:
>>
>>> From: "Christy Pang" <christy@borderware.com>
>>>
>>>> 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)--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?425B4318.70005>