From owner-freebsd-java@FreeBSD.ORG Tue May 30 11:23:31 2006 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8382C16A437 for ; Tue, 30 May 2006 11:23:31 +0000 (UTC) (envelope-from java@wecos.de) Received: from mail.terminmarktwelt.de (mail.terminmarktwelt.de [217.6.66.203]) by mx1.FreeBSD.org (Postfix) with SMTP id C6FDB43D46 for ; Tue, 30 May 2006 11:23:30 +0000 (GMT) (envelope-from java@wecos.de) Received: (qmail 67430 invoked by uid 98); 30 May 2006 13:16:48 +0200 Received: from 192.168.168.242 by mail.terminmarktwelt.de (envelope-from , uid 82) with qmail-scanner-1.25 ( Clear:RC:1(192.168.168.242):. Processed in 0.0563439999999999 secs); 30 May 2006 11:16:48 -0000 X-Qmail-Scanner-Mail-From: java@wecos.de via mail.terminmarktwelt.de X-Qmail-Scanner: 1.25 (Clear:RC:1(192.168.168.242):. Processed in 0.0563439999999999 secs) Received: from unknown (HELO cosinus.terminmarktwelt.de) (192.168.168.242) by 192.168.168.203 with SMTP; 30 May 2006 13:16:47 +0200 From: Heiko Weber Organization: Wecos To: Achilleus Mantzios Date: Tue, 30 May 2006 13:17:40 +0200 User-Agent: KMail/1.8.2 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200605301317.40658.java@wecos.de> Cc: freebsd-java@freebsd.org Subject: Re: Calendar Question - maybe bug ? X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2006 11:23:31 -0000 Am Dienstag, 30. Mai 2006 12:10 schrieb Achilleus Mantzios: > O Heiko Weber =DD=E3=F1=E1=F8=E5 =F3=F4=E9=F2 May 30, 2006 : > > Am Dienstag, 30. Mai 2006 08:19 schrieb Panagiotis Astithas: > > > Heiko Weber wrote: > > > > Hi ! > > > > > > > > I've a problem with GregorianCalendar, which returns different weeks > > > > (in year) on FreeBSD 6.1, java version is > > > > > > > > # java -version > > > > Java HotSpot(TM) Server VM (build 1.5.0-p2-heiko_03_jan_2006_23_51, > > > > mixed mode) > > > > > > > > Test program (A.java): > > > > > > > > import java.util.Calendar; > > > > import java.util.GregorianCalendar; > > > > > > > > public class A { > > > > public static int weeksInYear(int year) { > > > > Calendar cal =3D GregorianCalendar.getInstance(); > > > > > > > > cal.set(year, 11, 31); > > > > > > > > return cal.get(Calendar.WEEK_OF_YEAR) =3D=3D 53 ? 5= 3 : > > > > 52; } > > > > > > > > public static void main(String args[]) { > > > > for (int i =3D 1990; i <=3D 2006; i++) > > > > System.out.println("Weeks in Year " + i + "= =3D > > > > " + weeksInYear(i)); > > > > } > > > > } > > > > > > > > Output on a Linux or Windows JRE is: > > > > > > > > Weeks in Year 1990 =3D 52 > > > > Weeks in Year 1991 =3D 52 > > > > Weeks in Year 1992 =3D 53 > > > > Weeks in Year 1993 =3D 52 > > > > Weeks in Year 1994 =3D 52 > > > > Weeks in Year 1995 =3D 52 > > > > Weeks in Year 1996 =3D 52 > > > > Weeks in Year 1997 =3D 52 > > > > Weeks in Year 1998 =3D 53 > > > > Weeks in Year 1999 =3D 52 > > > > Weeks in Year 2000 =3D 52 > > > > Weeks in Year 2001 =3D 52 > > > > Weeks in Year 2002 =3D 52 > > > > Weeks in Year 2003 =3D 52 > > > > Weeks in Year 2004 =3D 53 > > > > Weeks in Year 2005 =3D 52 > > > > Weeks in Year 2006 =3D 52 > > > > > > > > Output on FreeBSD is: > > > > > > > > Weeks in Year 1990 =3D 52 > > > > Weeks in Year 1991 =3D 52 > > > > Weeks in Year 1992 =3D 52 > > > > Weeks in Year 1993 =3D 52 > > > > Weeks in Year 1994 =3D 53 > > > > Weeks in Year 1995 =3D 52 > > > > Weeks in Year 1996 =3D 52 > > > > Weeks in Year 1997 =3D 52 > > > > Weeks in Year 1998 =3D 52 > > > > Weeks in Year 1999 =3D 52 > > > > Weeks in Year 2000 =3D 52 > > > > Weeks in Year 2001 =3D 52 > > > > Weeks in Year 2002 =3D 52 > > > > Weeks in Year 2003 =3D 52 > > > > Weeks in Year 2004 =3D 52 > > > > Weeks in Year 2005 =3D 53 > > > > Weeks in Year 2006 =3D 52 > > > > > > > > Is this my fault or would it help to update the FreeBSD JRE ? Or is > > > > the java-Calendar-System build up on some local (changeable) settin= gs > > > > ? > > > > > > > > Thanks for any help or hint. > > > > > > I can't replicate this here on either diablo-jdk15 or jdk15 patchset 2 > > > (as yours). Is your systems time/timezone/etc. correct? > > > > Hm, /etc/localtime has been installed last year in september - from > > installation of FreeBSD 6.0. If I remember correct I used sysinstall and > > answered "cmos time =3D=3D local time". > > > > # date > > Tue May 30 09:48:36 CEST 2006 > > > > Is this ok for germany ? > > I think yes, it means Central European Time (CET) with saylight savings > (S). > > Applying > --- A.java.old Tue May 30 12:57:28 2006 > +++ A.java Tue May 30 12:57:37 2006 > @@ -11,6 +11,7 @@ > } > > public static void main(String args[]) { > + java.util.TimeZone.setDefault(null); > for (int i =3D 1990; i <=3D 2006; i++) > System.out.println("Weeks in Year " + i + " =3D= " > + weeksInYear(i)); > } > > Should give you a hint of whether the problem is TZ related. > > P.S. > Also with 1.4.2 I get the first result set. Hi Achilleus, the above "patch" makes no difference on my system. I compared /etc/localtime with the files in /usr/share/zoneinfo, it=20 is /usr/shared/zoneinfo/Europe/Berlin. Heiko