Re: Wrong result from System.currentTimeMillis()
- From: alberto.poz@xxxxxxxxx
- Date: Thu, 3 Jan 2008 04:16:08 -0800 (PST)
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.
.
- Follow-Ups:
- Re: Wrong result from System.currentTimeMillis()
- From: Roedy Green
- Re: Wrong result from System.currentTimeMillis()
- From: Andrew Thompson
- Re: Wrong result from System.currentTimeMillis()
- References:
- Wrong result from System.currentTimeMillis()
- From: alberto . poz
- Re: Wrong result from System.currentTimeMillis()
- From: Nigel Wade
- Wrong result from System.currentTimeMillis()
- Prev by Date: Re: Wrong result from System.currentTimeMillis()
- Next by Date: Re: Wrong result from System.currentTimeMillis()
- Previous by thread: Re: Wrong result from System.currentTimeMillis()
- Next by thread: Re: Wrong result from System.currentTimeMillis()
- Index(es):
Relevant Pages
|
|