Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 23153 invoked from network); 5 Jun 2002 21:09:32 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Jun 2002 21:09:32 -0000 Received: (qmail 18353 invoked by uid 97); 5 Jun 2002 21:09:14 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 18321 invoked by uid 97); 5 Jun 2002 21:09:13 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 18295 invoked by uid 98); 5 Jun 2002 21:09:13 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) User-Agent: Microsoft-Entourage/10.1.0.2006 Date: Wed, 05 Jun 2002 14:09:08 -0700 Subject: Re: Improper timing using Calendar class (JSP/servlet) From: Phillip Morelock To: Tomcat Users List Message-ID: In-Reply-To: <000001c20cd3$be68b0c0$0b00a8c0@morpheus> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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" 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:  <%= startTime %>
End Time:  <%= endTime%>
<%= > endTime - startTime %>
> > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > -- To unsubscribe, e-mail: For additional commands, e-mail: