Title: RE: OffTopic: System.currentTimeMillis
It's about 10x slower than System.currentTimeMillis().  If you look at the code for new java.util.Date() it calls System.currentTimeMillis() and does a bunch of other stuff, plus you have the overhead of creating and maintaining the object that you're about to throw away after the call to getTime(), which is simply returning the value originally retrieved from System.currentTimeMillis().
    (*Chris*)
----- Original Message -----
Sent: Thursday, October 18, 2001 12:42 AM
Subject: Re: [JSP-INTEREST] OffTopic: System.currentTimeMillis

What�s wrong with �new java.util.Date().getTime()� ?

 

  Mattias Jiderhamn

  Expert Systems

  [EMAIL PROTECTED]

 

-----Original Message-----
From: Steve Curd [mailto:steve.[EMAIL PROTECTED]]
Sent: Tuesday, October 16, 2001 6:56 PM
Subject: Re: OffTopic: System.currentTimeMillis

 

Take a look at java.util.Calendar.  You should be able to use that class to apply a Locale and Timezone to the value returned by System.currentTimeMillis. Then when you call getTimeInMillis() on your new Calendar object it should return the correct millisecond value.

-----Original Message-----
From: Joel Carklin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 16, 2001 8:06 AM
To: JSP-INTEREST@JAVA.SUN.COM
Subject: OffTopic: System.currentTimeMillis

 

Hi,

Slightly offtopic, but if anyone knows a better list to ask, let me know.
The method System.currentTimeMillis is supposed to return the the
difference, measured in milliseconds, between the current time and
midnight, January 1, 1970 UTC. AFAIK UTC is the same as GMT??
When converting this returned long value to a Timestamp, I get the
current time here in South Africa which is not GMT.

(it's +2, or -2 or something like that :-))

So the API says it returns the time in UTC but it doesn't??

Just wondering
Joel

==========================================================================To unsubscribe: mailto listserv@java.sun.com with body: "signoff JSP-INTEREST".

For digest: mailto [EMAIL PROTECTED]com with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 
http://java.sun.com/products/jsp/faq.html
 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
 
http://www.jguru.com/faq/index.jsp
 http://www.
jspinsider.com

 

Reply via email to