From owner-freebsd-java Tue Apr 25 10:51:15 2000 Delivered-To: freebsd-java@freebsd.org Received: from firewall.ox.com (firewall.ox.com [129.77.1.1]) by hub.freebsd.org (Postfix) with ESMTP id 68ADD37B937 for ; Tue, 25 Apr 2000 10:51:10 -0700 (PDT) (envelope-from rcf@ox.com) Received: from firewall.ox.com (root@localhost) by firewall.ox.com with ESMTP id NAA05985 for ; Tue, 25 Apr 2000 13:51:04 -0400 (EDT) Received: from pur-wk-rfurphy.ny.ox.com (pur-wk-rfurphy.ny.ox.com [129.77.2.133]) by firewall.ox.com with ESMTP id NAA05981 for ; Tue, 25 Apr 2000 13:51:04 -0400 (EDT) Received: from ox.com (localhost.ny.ox.com [127.0.0.1]) by pur-wk-rfurphy.ny.ox.com (8.9.3/8.9.3) with ESMTP id NAA34512 for ; Tue, 25 Apr 2000 13:51:03 -0400 (EDT) (envelope-from rcf@ox.com) Message-ID: <3905DB07.D847E037@ox.com> Date: Tue, 25 Apr 2000 13:51:03 -0400 From: Rob Furphy X-Mailer: Mozilla 4.7 [en] (X11; I; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-java@freebsd.org Subject: Time - is it right? Content-Type: multipart/mixed; boundary="------------8736DFD88AA5CD5BB55A8503" Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------8736DFD88AA5CD5BB55A8503 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 --------------8736DFD88AA5CD5BB55A8503 Content-Type: text/plain; charset=us-ascii; name="foo.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="foo.java" /* 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; } } --------------8736DFD88AA5CD5BB55A8503-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message