Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Apr 2000 17:05:30 -0400
From:      Rob Furphy <rcf@ox.com>
To:        freebsd-java@freebsd.org, glewis@trc.adelaide.edu.au
Subject:   *BETTER* Pre-alpha JDK 1.2.2 TimeZone (time) bug fix
Message-ID:  <39075A1A.70DBE0F1@ox.com>
References:  <39061716.2E69B654@ox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello all,

In my fix from yesterday although the wall clock time was correct, the
timezone
was incorrect and the JVM was defaulting to a generic timezone which set
the
jvm's clock to the best guess of what a 'wall clock' would say the time
was.

Needless to say this eventually fails if you ever cross a daylight savings
time boundry
while the jvm is running.

I have a better code fix now which I think will work for all cases and give
the
correct time and timezone.  I now get the correct time and the timezone is
"America/New_York" as I expect.

Could everyone else please try this new change to see if it works in your
timezone?


My informal way to get this into the next patchset is here:

in src/freebsd/native/java/lang/java_props_md.c at line 283 you'll find

#ifdef __FreeBSD__ /*** XXX ***/
        hasDST = local_tm->tm_isdst;
        offset = local_tm->tm_gmtoff;
#else
        hasDST = daylight == 0 ? kStandard : kDaylight;
        offset = timezone / -60; /* Conventions reversed between UNIX &
Java */
#endif


change this to:

#ifdef __FreeBSD__ /*** XXX ***/

        hasDST = (local_tm->tm_isdst == 0) ? kStandard :
kDaylight;                            /*** changed  line ***/
        offset = (local_tm->tm_gmtoff / 60) - (local_tm->tm_isdst == 0 ? 0
: 60);      /*** re-changed line ***/

#else
        hasDST = daylight == 0 ? kStandard : kDaylight;
        offset = timezone / -60; /* Conventions reversed between UNIX &
Java */
#endif


Rob F



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?39075A1A.70DBE0F1>