I'm trying to determine the elapsed time on a CF page. This is what I've tried: <cfset x = now()> . more code here... . <cfset elapsed_time = now() - x> <cfoutput> Time: #elapsed_time# </cfoutput> I get the following: Time: 1.15740767797E-005 I've looked at Number/Decimal format functions, but then all I get is a 0.00 TIA...
is there anything triggering when the elapsed_time is calculated? if not the time 1.15740767797E-005 is probably the number of seconds it takes to run through the code between the two cfsets. if you want to though, you can use the datediff function and dateformat function to get things working a little more smoothly <cfset elapsed_time_seconds = datediff("s", x, now())> Code (markup): that would get the difference in seconds for you i believe. I don't know all that much about these functions but hopefully i've helped you on your path.
I usually use getTickCount() to calculate elapsed time. It returns milliseconds but you could easily convert it to seconds. not tested <cfset start = getTickCount() /> .... <cfoutput> Time: #(getTickCount() - start)# </cfoutput> Code (markup):