Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2000 16:08:30 -0400
From:      Rob Furphy <rcf@ox.com>
To:        freebsd-java@FreeBSD.ORG
Subject:   Re: Time - is it right?
Message-ID:  <3905FB3D.1ECE5D4B@ox.com>
References:  <3905DB07.D847E037@ox.com>

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

I just reread Kees Jan Koster's site and found the exact bug I'm talking about, so it
is
known.  I've done some more digging and found that the system property
"user.timezone" is "GMT+00:00"  so that is definately why the Calendar classes
are reporting the time as they are.  Perhaps the error is in java_props_md.c.

In the GetJavaProperties() call there is a snippet of code for the variables
hasDST and offset which are set.  Is this getting set incorrectly?
(The comment above the code is /*** XXX ***/).


Rob F


Rob Furphy wrote:

> Hi,
>
> I've got a native freebsd jdk1.2.2 built using
>
> FreeBSD 3.4 RELEASE (not STABLE)
> gcc 2.7.2.3 (not 2.95.2)
> lesstif 0.89.4 (not 0.89.9)
> GNU make 3.77 (not 3.78.1)
> GNU m4 1.4
> dgs 0.5.8 (not 0.5.9)
> unixODBC 1.8.7
>
> I am happy to report initial success in a number of areas.  Multicast
> sockets work correctly.  Database access is good.
>
> The build is only about an hour old so I haven't tested alot yet but I
> find that GregorianCalendar
> and Date are not working correctly.
>
> It seems the problem is in the TimeZone class or in what the TimeZone
> class relies upon.  I've attached a small
> java program to demonstrate.  Basically the default time zone under the
> native freebsd jdk comes out as 'Custom'
> and under the Linux RC4 the TimeZone is correct.  Is this an issue with
> my system/build or are other people seeing this?
>
> Thanks to all for this port. I see good things ahead...
>
> Rob F
>
>   ------------------------------------------------------------------------
> /*
>  When run under the Linux RC4 JDK I get the expected result and the correct time.
>  Under the FreeBSD native port I seem to be getting GMT time, reported as 'Custom'
>  in the GregorianCalendar.toString().  Daylight savings is also wrong but I suspect
>  that is because the timezone is incorrect
>  */
>
>
> import java.util.*;
>
> public class foo {
>
>     public foo(String args[]) {
>     }
>
>     static public void main(String args[]) {
>
>         foo me = new foo(args);
>         me.doIt();
>
>         System.exit(0);
>     }
>
>     private void doIt() {
>
>         System.out.println(getHHMMSS(new GregorianCalendar()));
>         System.out.println(getHHMMSS(new GregorianCalendar(TimeZone.getDefault())));
>
>         System.out.println(new Date().toString());
>
>         System.out.println("\n" + new GregorianCalendar().toString());
>     }
>
>     private String getHHMMSS(GregorianCalendar now) {
>
>         int hours = now.get(Calendar.HOUR_OF_DAY);
>         if(hours > 12) {
>             hours -= 12;
>         }
>         int mins = now.get(Calendar.MINUTE);
>         int secs = now.get(Calendar.SECOND);
>
>         String ampm = (now.get(Calendar.AM_PM) == Calendar.AM) ? "am" : "pm";
>
>         return timeString(hours, mins, secs) + ampm;
>     }
>
>     private String timeString(int hour, int minute, int sec) {
>
>         String answer = "" + hour + ":";
>
>         if(minute < 10) {
>             answer += "0";
>         }
>         answer += minute + ":";
>
>         if(sec < 10) {
>             answer += "0";
>         }
>         answer += sec;
>
>         return answer;
>     }
>
> }



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?3905FB3D.1ECE5D4B>