TimeZone Defaults]
Kurt Miller
truk at optonline.net
Mon Apr 11 21:17:38 PDT 2005
Kurt Miller wrote:
>
> ----- Original Message ----- From: "Christy Pang"
> <christy at borderware.com>
> To: "Kurt Miller" <truk at optonline.net>
> Cc: <freebsd-java at freebsd.org>
> Sent: Monday, April 11, 2005 11:41 PM
> Subject: Re: TimeZone Defaults]
>
>
>> Kurt Miller wrote:
>>
>>> From: "Christy Pang" <christy at 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 at 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
-------------- next part --------------
$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) {
More information about the freebsd-java
mailing list