From owner-freebsd-java@FreeBSD.ORG Tue May 30 09:59:18 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 00AE316A705 for ; Tue, 30 May 2006 09:59:18 +0000 (UTC) (envelope-from achill@matrix.gatewaynet.com) Received: from matrix.gatewaynet.com (host2.dynacom.ondsl.gr [62.103.35.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1974B43D4C for ; Tue, 30 May 2006 09:59:16 +0000 (GMT) (envelope-from achill@matrix.gatewaynet.com) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id k4UAAOew017643; Tue, 30 May 2006 13:10:24 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id k4UAALN6017639; Tue, 30 May 2006 13:10:21 +0300 Date: Tue, 30 May 2006 13:10:21 +0300 (EEST) From: Achilleus Mantzios To: Heiko Weber In-Reply-To: <200605301000.35042.java@wecos.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT Cc: Panagiotis Astithas , 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 09:59:18 -0000 O Heiko Weber έγραψε στις 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 = GregorianCalendar.getInstance(); > > > > > > cal.set(year, 11, 31); > > > > > > return cal.get(Calendar.WEEK_OF_YEAR) == 53 ? 53 : 52; > > > } > > > > > > public static void main(String args[]) { > > > for (int i = 1990; i <= 2006; i++) > > > System.out.println("Weeks in Year " + i + " = " + > > > weeksInYear(i)); > > > } > > > } > > > > > > Output on a Linux or Windows JRE is: > > > > > > Weeks in Year 1990 = 52 > > > Weeks in Year 1991 = 52 > > > Weeks in Year 1992 = 53 > > > Weeks in Year 1993 = 52 > > > Weeks in Year 1994 = 52 > > > Weeks in Year 1995 = 52 > > > Weeks in Year 1996 = 52 > > > Weeks in Year 1997 = 52 > > > Weeks in Year 1998 = 53 > > > Weeks in Year 1999 = 52 > > > Weeks in Year 2000 = 52 > > > Weeks in Year 2001 = 52 > > > Weeks in Year 2002 = 52 > > > Weeks in Year 2003 = 52 > > > Weeks in Year 2004 = 53 > > > Weeks in Year 2005 = 52 > > > Weeks in Year 2006 = 52 > > > > > > Output on FreeBSD is: > > > > > > Weeks in Year 1990 = 52 > > > Weeks in Year 1991 = 52 > > > Weeks in Year 1992 = 52 > > > Weeks in Year 1993 = 52 > > > Weeks in Year 1994 = 53 > > > Weeks in Year 1995 = 52 > > > Weeks in Year 1996 = 52 > > > Weeks in Year 1997 = 52 > > > Weeks in Year 1998 = 52 > > > Weeks in Year 1999 = 52 > > > Weeks in Year 2000 = 52 > > > Weeks in Year 2001 = 52 > > > Weeks in Year 2002 = 52 > > > Weeks in Year 2003 = 52 > > > Weeks in Year 2004 = 52 > > > Weeks in Year 2005 = 53 > > > Weeks in Year 2006 = 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) settings ? > > > > > > 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 == 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 = 1990; i <= 2006; i++) System.out.println("Weeks in Year " + i + " = " + 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. > > At the moment I compile jdk with patchset 3 on an other FreeBSD system to > verify ... there I can play with the timezone settings after installation. > > Thanks for the hint. > > Heiko > _______________________________________________ > freebsd-java@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org" > -- -Achilleus