Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > System.currentTimeMillis()

Reply
Thread Tools

System.currentTimeMillis()

 
 
Jerry
Guest
Posts: n/a
 
      08-03-2005
System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
time that depends on the current OS and time zone?

Thanks a lot!

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      08-03-2005
On 3 Aug 2005 09:46:54 -0700, Jerry wrote:

> System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
> time that depends on the current OS and time zone?


Test it, report back.

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Bender's Humor By 'Microsoft Joke'
 
Reply With Quote
 
 
 
 
Harry Bosch
Guest
Posts: n/a
 
      08-03-2005
Jerry wrote:
> System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
> time that depends on the current OS and time zone?
>
> Thanks a lot!


Right here in the JavaDoc:

http://java.sun.com/j2se/1.4.2/docs/...entTimeMillis()

"returns the difference, measured in milliseconds, between the current
time and midnight, January 1, 1970 UTC"

 
Reply With Quote
 
Thomas Hawtin
Guest
Posts: n/a
 
      08-03-2005
Jerry wrote:
> System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
> time that depends on the current OS and time zone?


"Returns:
"the difference, measured in milliseconds, between the current time
and midnight, January 1, 1970 UTC."

So what do you think?

Having said people often have incorrectly set time zones and spin UTC
around themselves. And PCs apparently having the BIOS time time zone
dependent (and not specified) doesn't help.

I also find on my machine (RedHat 9), nanoTime goes backwards with the
system clock, which it shouldn't.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-03-2005
Jerry wrote:
> System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
> time that depends on the current OS and time zone?
>
> Thanks a lot!
>


Did you read the documentation for the method?

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      08-03-2005
The Java Doc says: "Returns the current time in milliseconds. Note that
while the unit of time of the return value is a millisecond, the
granularity of the value depends on the underlying operating system and
may be larger."

Does this mean that System.currentTimeMillis() return the teime that
depends on the current OS and time zone?

Thanks a lot!



Harry Bosch wrote:
> Jerry wrote:
> > System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
> > time that depends on the current OS and time zone?
> >
> > Thanks a lot!

>
> Right here in the JavaDoc:
>
> http://java.sun.com/j2se/1.4.2/docs/...entTimeMillis()
>
> "returns the difference, measured in milliseconds, between the current
> time and midnight, January 1, 1970 UTC"


 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      08-03-2005
The difference, measured in milliseconds, between the current time and
midnight, January 1, 1970 UTC

The current time means the current UTC time in Milliseconds or the
current OS and Timezone time in Milliseconds?

Thanks!

 
Reply With Quote
 
Pete Barrett
Guest
Posts: n/a
 
      08-03-2005
On 3 Aug 2005 09:46:54 -0700, "Jerry" <> wrote:

>System.currentTimeMillis() retuns current UTC time in MilliSeconds or a
>time that depends on the current OS and time zone?
>

It returns the number of milliseconds since the epoch (which is
midnight Jan 1st 1970 UTC. (This is in the JavaDocs.)

Or, to put it another way, Java seems to consider local time and UTC
to be different presentations of the same time, not different times.
It goes all the way through Java, so you'd better learn to think in
that way!

Pete Barrett
 
Reply With Quote
 
Thomas Fritsch
Guest
Posts: n/a
 
      08-03-2005
Jerry wrote:
> The difference, measured in milliseconds, between the current time and
> midnight, January 1, 1970 UTC
>
> The current time means the current UTC time in Milliseconds or the
> current OS and Timezone time in Milliseconds?
>
> Thanks!
>

"Current time" simply means: "now", "at this moment".
This definition is complete by itself. There is no reference to any OS
or timezone needed to make the definition complete.
Remember: time did already exist before computers or time-zones were
invented.

--
"Thomas:Fritsch$ops:de".replace(':','.').replace(' $','@')

 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      08-03-2005
It returns the number of milliseconds since the epoch (which is
midnight Jan 1st 1970 UTC.

The current time means the current UTC time in Milliseconds or the
current OS and Timezone time in Milliseconds?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57