๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7897

Re: Problem with time zones ...

#7897
From: John McGrath TeamB
Date: Sat, 12 May 2001 10:41
62 lines
3345 bytes
On 11 May 2001 07:14:31 -0700, Edwin G๏ฟฝnthner wrote:

> On my machine: 
>   989590582105 = Freitag, 11. Mai 2001 16.16 Uhr GMT+02:00
> 
> Our customer:
>   989593621197 = Freitag, 11. Mai 2001 17.07 Uhr GMT+02:00
 
I should have asked what the clock said when you ran the programs
on the two different machine.  Based on your previous message,
I am guessing that you ran it first on your customer machine at
4:07 PM, and then 9 minutes later on your machine.

When I run the program (modified to allow me to specify the time 
values) using those values on my machine, I get the following

    989590582105 = Friday, May 11, 2001 10:16:22 AM EDT
    989593621197 = Friday, May 11, 2001 11:07:01 AM EDT

As you can see, it prints out the same times, although they are 
formatted differently, since I am in a different time zone.  If
I changed the code to specify your locale, I would get the same 
strings that you get.

This seems to indicate that the Java code is formatting the time values 
correctly, but that it is getting the wrong "current" time value from 
the operating system.  If the problem was related to the formatting 
(for example, incorrect time zone), you would see a disparity between 
the long time values and the formatted strings.

Do you have a "C" compiler available?  If so, you could try running 
this program:

    int main() {
        printf( "time = %d\n", time() );
    }

If you run it and the Java program at the same time, the Java program 
should print a value 1000 times the value printed by the C program, 
since Java time values are in milliseconds and C time values are in 
seconds.

If the problem is that the JVM is somehow misconfigured, so it is not 
getting the time from Windows correctly, then the values will not match 
as described.

If the clocks are actually set differently on the two machines, but 
something like the time zone configuration is set to compensate, then 
you would probably get a value that is different by about 3600 (after 
dividing the Java value by 1000).

Just in case you do not have a C compiler, I placed a copy of the 
program executable at:  http://jpmcgrath.net/misc/time.exe

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.1566cf03d4ac0c0f98a1cc@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3af7da0f$1_2@dnews> <MPG.1562bdeacce5495b98a1b2@forums.borland.com> <3afa34d2$1_1@dnews> <MPG.156424c7a806f3d698a1c5@forums.borland.com> <3afbf3c7$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,a59c8cd977ce05a
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-12 04:10:07 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Problem with time zones ...
Date: Sat, 12 May 2001 06:41:15 -0400
Message-ID: <MPG.1566cf03d4ac0c0f98a1cc@forums.borland.com>
References: <3af7da0f$1_2@dnews> <MPG.1562bdeacce5495b98a1b2@forums.borland.com> <3afa34d2$1_1@dnews> <MPG.156424c7a806f3d698a1c5@forums.borland.com> <3afbf3c7$1_2@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 989664075 209.92.40.60 (12 May 2001 03:41:15 -0700)
Lines: 62
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews