While trying to debug a timing issue in other code, it was noticed that
timestamps in Cacao log files were incorrect. Investigation by a Cacao
engineer highlighted a problem with JVM timezone handling on S11.
On a system running s10s_u10wos_10, and Java version:
---
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
---
and in timezone MET the simple program given in the comments works as expected:
$ date ; java ShowDate
Tuesday, September 20, 2011 10:42:01 AM MEST
Timezone is Middle Europe Time
Date is Tue Sep 20 10:42:01 MEST 2011
however trying the same program on a system with Solaris 11 snv_173 and
Java version:
--
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)
--
the program shows that the system time is correct, but the time seen by
Java is one hour out:
$ date ; java ShowDate
Tue Sep 20 01:41:24 PDT 2011
Timezone is GMT-08:00
Date is Tue Sep 20 00:41:24 GMT-08:00 2011
For the second system the timezone is set to US/Pacific, but uses the
post-PSARC/2011/057 mechanism. File /etc/default/init contains the line:
TZ=localtime
and the timezone file links are:
/usr/share/lib/zoneinfo/localtime -> ../../../../etc/localtime
/etc/localtime -> ../usr/share/lib/zoneinfo/US/Pacific
Setting the TZ variable to be US/Pacific directly in my environment gives
the correct behaviour:
$ setenv TZ US/Pacific
$ date ; java ShowDate
Tue Sep 20 01:45:35 PDT 2011
Timezone is Pacific Standard Time
Date is Tue Sep 20 01:45:36 PDT 2011
It seems that the JVM isn't handling the S11 configuration method correctly.