Re: Wrong result from System.currentTimeMillis()



On 3 Gen, 12:36, Nigel Wade <n...@xxxxxxxxxxxx> wrote:
alberto....@xxxxxxxxx wrote:

Hi, running in a RedHat linux 2.6.9 environment I get:

# date
Thu Jan 3 11:14:29 Europe/Rome 2008

# hwclock
Thu 03 Jan 2008 11:14:49 AM Europe/Rome -0.940606 seconds

but

System.out.println(new Date(System.currentTimeMillis()));

produces:

Thu Jan 03 12:14:38 CET 2008

What's wrong?

Maybe Java isn't picking up the default timezone correctly.

What does this output?

System.out.println(TimeZone.getDefault().getID());

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : n...@xxxxxxxxxxxx
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555

It shows the expected output:

Europe/Rome

I don't think it depends on timezone: I tried to compare the output of
System.currentTimeMillis() in my RedHat and in a Win XP where I get
correct results. They differ by about 1 hour (60 * 60 * 1000) as if
system clock was wrong but it isn't.

.



Relevant Pages

  • Re: RE: ldap authorization
    ... Subject: ldap authorization ... Nigel Wade, System Administrator, Space Plasma Physics Group, ... University of Leicester, Leicester, LE1 7RH, UK ...
    (RedHat)
  • Re: two or more jvm in a single machine
    ... Nigel Wade, System Administrator, Space Plasma Physics Group, ... University of Leicester, Leicester, LE1 7RH, UK ...
    (comp.lang.java.programmer)
  • Re: viva questions - any ideas?
    ... Nigel Wade, System Administrator, Space Plasma Physics Group, ... University of Leicester, Leicester, LE1 7RH, UK ...
    (comp.lang.java.programmer)
  • Re: response
    ... Nigel Wade, System Administrator, Space Plasma Physics Group, ... University of Leicester, Leicester, LE1 7RH, UK ...
    (comp.lang.java.programmer)
  • Re: Problems with User Authentication using PAM & LDAP
    ... Bruno Tobias Stella wrote: ... Nigel Wade, System Administrator, Space Plasma Physics Group, University of Leicester, Leicester, LE1 7RH, UK ...
    (Fedora)