Topic
1 reply Latest Post - ‏2010-10-08T11:14:49Z by foxrafi
foxrafi
foxrafi
2 Posts
ACCEPTED ANSWER

Pinned topic /usr/share/zoneinfo/Poland vs /usr/share/zoneinfo/Europe/Warsaw problem.

‏2010-10-07T12:44:29Z |
Hi,
I have got the RedHat operating system on PPC64:
root@host zoneinfo# uname -a
Linux host 2.6.18-128.el5 #1 SMP Wed Dec 17 11:58:23 EST 2008 ppc64 ppc64 ppc64 GNU/Linux
root@host zoneinfo# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)

There is also the following timezone:
root@host zoneinfo# date
Thu Oct 7 14:20:49 CEST 2010
root@host zoneinfo# date -u
Thu Oct 7 12:20:52 UTC 2010
root@host zoneinfo# cat /etc/sysconfig/clock
ZONE="Poland/Warsaw"
UTC=false
ARC=false
As you can see the Central European Summer Time is set and it is moved 2 hours ahead in comparison to GMT/UTC.

On this machine IBM Java 5.0 (J2RE 1.5.0 IBM J9 2.3) is also installed.

I wrote a simple program in Java to check the default timezone and I found that Java thought CEST was moved only one hour (it should be 2 hours of course) ahead in comparison to GMT. Below I placed a code and the result:

package test;
import java.util.Date;
public class df {
public static void main(String[] args) {
System.out.println("java.util.TimeZone");
java.util.TimeZone u2 = java.util.TimeZone.getDefault();

//the name of timezone
System.out.println(u2.getDisplayName());

//the number of miliseconds between GMT and the current timezone (difference)
System.out.println(u2.getOffset(new Date().getTime()));

//in some countries we add one hour to time to get a daylist saving time
System.out.println(u2.getDSTSavings());
}
}

When I run this program I get this result:
GMT+01:00
3600000
0

My question is why the "date" command display the correct time (GMT+2) but Java shows something different (GMT+1) ?
Is that associated with the content of /usr/share/zoneinfo/Poland file ?
When I used a different timezone file for Poland, i.e. /usr/share/zoneinfo/Europe/Warsaw I got the correct result:
Central European Time
7200000
3600000

FYI: Warsaw is a capital of Poland.

Thank you for any help, answer and advice
Best regards,
Rafal
Updated on 2010-10-08T11:14:49Z at 2010-10-08T11:14:49Z by foxrafi
  • foxrafi
    foxrafi
    2 Posts
    ACCEPTED ANSWER

    Re: /usr/share/zoneinfo/Poland vs /usr/share/zoneinfo/Europe/Warsaw problem.

    ‏2010-10-08T11:14:49Z  in response to foxrafi
    I have found the solution for this problem. I had wrong definition of timezone in /usr/sysconfig/clock. There were ZONE="Poland/Warsaw" instead of ZONE="Europe/Warsaw" or ZONE="Poland".