tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Morelock <subscripti...@phillipmorelock.com>
Subject Re: Improper timing using Calendar class (JSP/servlet)
Date Wed, 05 Jun 2002 21:09:08 GMT
System.currentTimeMillis()

fillup


Also, the Date class is deprecated, and the Calendar class should be used
via the concrete culture-specific subclass, in Western society this is
GregorianCalendar.



On 6/5/02 1:58 PM, "Trenton D. Adams" <trent.nospam@telusplanet.net> wrote:

> I've found that he only time that startTime and endTime get a new value
> is when tomcat is restarted.  You can refresh the page any number of
> times you want, but it still shows the same numbers until tomcat is
> restarted.  It's almost as if the value returned by the Calendar class
> is the startup time of tomcat, and not the actual system time.  Is this
> correct?  If so, it's a bug right?  If not, how can it be solved?
> 
> -----Original Message-----
> From: Trenton D. Adams [mailto:trent.nospam@telusplanet.net]
> Sent: June 5, 2002 2:44 PM
> To: 'Tomcat Users List'
> Subject: Improper timing using Calendar class (JSP/servlet)
> 
> 
> I'm kind of curious.  I've been trying to do some simple performance
> timing with the Calendar class as shown below.  The startTime and
> endTime end up being the same value.  How can this be?  There should be
> at the very least a ms or two difference between them, shouldn't there?
> The same thing happens in JSP pages as it does in servlet pages.  In
> fact, in a servlet, I tried doing a Thread.Sleep (10000), and the
> startTime and endTime were still the same.  Is this a bug in tomcat?
> 
> 
> 
> <%! long startTime = Calendar.getInstance ().getTimeInMillis();%>
> 
> Do some HTML output.
> 
> <%! long endTime = Calendar.getInstance ().getTimeInMillis();%> Start
> Time:&nbsp <%= startTime %><BR> End Time:&nbsp <%= endTime%><BR>
<%=
> endTime - startTime %><BR>
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message