troubleshooting Question

extract and substract between  start and end-time for " for loop"  in asp

Avatar of rwniceing
rwniceing asked on
ASPJavaScript
3 Comments1 Solution282 ViewsLast Modified:
Dear Exerts,

I try to extract the total execution time of the for loop in the following asp code
and since vbscript is not doing well  with miilli-second extraction, so I use javascript code
for extracting time in ms from start and ending of for loop.

Now the code is working, it show the Start and End time. But how to
do substraction  on start-time - end time ?

I tried  put  the end-time javascript right after <% %> similar code to the start time  javascript code. But it showed the wrong result that is why I put into head tag for end time javascript code.

Any better approach for doing that ?

Please advise

Rwniceing


<!DOCTYPE html>
<html>
<script language=javascript runat=server> 
var myvar = Date.UTC(a.getFullYear(),a.getMonth(),a.getDay(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds());
	response.write("Start time in ms: " + myvar );
    </script>
<%
Dim i,a,b,c
for i = 1 to 2e6
a=1234+5678+i
b=1234*5678+i
c=1234/2+i
next
response.write("<br/>(i,a,b,c)=" & i & "=" &  a & "=" & b & "=" &c & "<br/>")
%>
<body>
</body>
<head runat="server">
    <title>Demo Page for Test</title>
    <script language="javascript" type="text/javascript" >
 var a = new Date();
var myvar = Date.UTC(a.getFullYear(),a.getMonth(),a.getDay(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds());
	document.write("End&nbsp;&nbsp;time in ms: ",myvar);
   </script>
</head>
</html>
ASKER CERTIFIED SOLUTION
Robert Schutt
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros