You two got me curious... on my linux 117_v1a the system is set to CST via
/etc/localtime -> ../usr/share/zoneinfo/US/Central and `date` returns times
in CDT as expected... (three weeks ago it returned CST as expected) HOWEVER
user.timezone is always EST when I start java, and System.out.println(new
Date()); results in EDT (at least it's consistent...) If I over-ride
user.timezone on the command line with CST then I get CDT, as expected, and
if I override with CDT I get GMT from the println. (believe it or not...
also as expected!)
The only difference between Linux and (IBM's) NT then is that NT sets
user.timezone to _my_ timezone instead of arbitrarily picking EST. Why
isn't Linux??
At 10:16 AM 4/15/99 -0500, Marius Schamschula wrote:
>Feng-Cheng,
>
>You beat me to the post. I've got a similar, related?, problem. I have
>two machines, both running mkLinux DR3. The older runs jdk117_v1a. I've
>got a simple directory listing cgi, JFind, running under Apache (I
>directly use java, not Jserv, via a shell wrapper). It returns the
>correct CST and CDT. The newer machine is running jdk12pre. It returns
>EST and EDT, whereas the unix shell command date returns the correct
>time zone: CST and CDT. JFind uses the java.util.Date routines:
>
>File f = new File (somefile);
>Date d = new Date (f.lastModified ());
>
>Does anyone know what is going on?
I think there has been some massive reworking of the java.util.Date, and
Gregorian Calendar from 1.1 to 1.2... I wouldn't be surprised if something
broke in the process.
Feng-Cheng wrote:
>Hello all,
> I have a question about the time zone settings:
> My Linux box is using local CST time, but the java.lang.Calendar or
>java.lang.Date always report CDT...
> Here is my program:
>----------------
>import java.lang.*;
>import java.util.*;
>
>public class TestCal {
> public static void main(String[] argv) {
> Calendar cal = Calendar.getInstance();
> System.out.println(cal.getTime());
> }
>}
>----------------
>The output of the program is always CDT time.
^^^^^^
By "always" you mean since the first Sunday of April right? This is correct
behavior. To test this set your clock back to February or March and run your
program again... it'll report CST. There is probably an option somewhere in
Calendar to not adjust to daylight savings time... but it might confuse a
few people if the clock on the wall and the program don't agree eight months
out of the year. -=Chris
!NEW!-=> <*> cabbey at home dot net http://members.home.net/cabbey/ <*>
"What can Microsoft do? They certainly can't program around us." - Linus
-----BEGIN GEEK CODE BLOCK----- Version:3.12 http://www.geekcode.com
GCS$/IT/PA$ d(-) s++:+ a-- C+++$ UL++++ UA++$ P++ L++ E- W++ N+ o? K? !P
w---(+)$ O- M-- V-- Y+ PGP+ t--- 5++ X+ R tv b+ DI+++ D G e++ h(+) r@ y?
------END GEEK CODE BLOCK------
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]