Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get timestamp/milliseconds

Status
Not open for further replies.

nadskram

Programmer
May 21, 2001
41
US
a fellow developer and i are comparing code to see who's runs faster, but we need a timestamp to compare with.

how can i get to that using asp, NOT .net

any suggestions would be great
 
Try this:

1 - On your asp page set blnDebug = true
2 - call StartTimer anywhere in the code you want to begin timing.
3 - call StopTimer anywhere you want to end timing.
4 - call OutputTimer to see the results

Dim timerTime
Dim timerOutput
Dim totalElapsedTime
Dim blnDebug
Dim totalTime
totalTime = Timer

'******************************************************
'Name: startTimer
'Parameters: strMessage
'Return:
'Description: Function to start a Timer before a process starts. This must be used in conjunction
' with stopTimer after the process is complete
'******************************************************
Function startTimer(strMessage)
If blnDebug Then
timerTime = Timer
End If
End Function

'**********************************************************''Name: stopTimer
'Parameters: strMessage
'Return:
'Description: Function to stop a Timer after a process is complete. This must be used in conjunction
' with startTimer before the process starts. The specific process name should be passed
' as a parameter to display the correct message
'********************************************************
Function stopTimer(strMessage)
If blnDebug Then
timerTime = Timer - timerTime
timerOutput = timerOutput & &quot;<tr><td>Elapsed Time for &quot; & strMessage & &quot;:</td><td><b>&quot; & timerTime & &quot; sec.</b></td></tr>&quot;
totalElapsedTime = totalElapsedTime + timerTime
End If
End Function


'******************************************************
'Name: outputTimer
'Parameters: none
'Return:
'Description: Function to ouptut timings set throughout the request blnDebug is set to true
'******************************************************
Function outputTimer()
If blnDebug Then
timerOutput = timerOutput & &quot;<tr><td><b>Elapsed Time for selected processes: </b></td><td><b>&quot; & totalElapsedTime & &quot; sec.</b></td></tr>&quot;
timerOutput = timerOutput & &quot;<tr><td>Miscellaneous process Time: </td><td><b>&quot; & ((Timer - totalTime) - totalElapsedTime) & &quot; sec.</b></td></tr>&quot;
timerOutput = timerOutput & &quot;<tr><td><b>Total Page Execution Time: </b></td><td><b>&quot; & (Timer - totalTime) & &quot; sec.</b></td></tr>&quot;
timerOutput = timerOutput & &quot;<tr><td><b>Test Date & Time: </b></td><td><b>&quot; & now() & &quot; </b></td></tr>&quot;
Response.write &quot;<table>&quot; & timerOutput & &quot;</table>&quot;
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top