Re: Wrong result from System.currentTimeMillis()
- From: alberto.poz@xxxxxxxxx
- Date: Thu, 3 Jan 2008 23:32:35 -0800 (PST)
On 4 Gen, 04:24, Roedy Green <see_webs...@xxxxxxxxxxxxxxxxxxxx> wrote:
On Thu, 3 Jan 2008 04:16:08 -0800 (PST), alberto....@xxxxxxxxx wrote,
quoted or indirectly quoted someone who said :
They differ by about 1 hour (60 * 60 * 1000) as if
system clock was wrong but it isn't.
That sounds suspiciously like a daylight saving problem.
Did someone manually adjust the clock by one hour rather than setting
the timezone and letting the OS adjust?
In all your calculations, keep printing the timezone to make sure it
is what you think, also the various offsets. Seehttp://mindprod.com/jgloss/timezone.html
--
Roedy Green Canadian Mind Products
The Java Glossaryhttp://mindprod.com
As I said both system clock and TZ appear to be correct .
That's what this code fragment produces:
TimeZone tz1 = TimeZone.getDefault();
System.out.println(tz1.getDisplayName());
System.out.println(System.getProperty( "user.timezone" ));
System.out.println(new Date());
Central European Time
Europe/Rome
Fri Jan 04 09:22:36 CET 2008
While the OS date command produces:
Fri Jan 4 08:22:48 Europe/Rome 2008
(1 hour less)
N.B. the env command shows:
..
..
..
TZ=Europe/Rome
..
..
.
- Follow-Ups:
- Re: Wrong result from System.currentTimeMillis()
- From: Mark Rafn
- Re: Wrong result from System.currentTimeMillis()
- From: Roedy Green
- Re: Wrong result from System.currentTimeMillis()
- From: Nigel Wade
- 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
- Re: Wrong result from System.currentTimeMillis()
- From: alberto . poz
- Re: Wrong result from System.currentTimeMillis()
- From: Roedy Green
- Wrong result from System.currentTimeMillis()
- Prev by Date: Re: Great SWT Program
- Next by Date: Re: try - catch box
- Previous by thread: Re: Wrong result from System.currentTimeMillis()
- Next by thread: Re: Wrong result from System.currentTimeMillis()
- Index(es):