CFLib.org – Common Function Library Project

MsToSec(tick)

Last updated November 26, 2001

author

Pete Ruckelshaus

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Converts milliseconds (as in GetTickCount() or cfquery.executiontime) to seconds. Simple but very useful.

Return Values:
Returns a numeric value.

Example:

<cfset preloadStart = getTickCount()>
  Do something here that takes time...
  <CFSET x=1>
  <CFLOOP INDEX="i" FROM="1" TO="1000">
    <CFSET x=x+1>
  </CFLOOP>
<cfset preloadFinish = getTickCount()>
<cfset preloadTime = preloadFinish - preloadStart>

<cfoutput>#MsToSec(preLoadTime)#</cfoutput>

Parameters:

Name Description Required
tick Number of milliseconds you want converted to seconds. Yes

Full UDF Source:

/**
 * Converts milliseconds to seconds.
 * 
 * @param tick 	 Number of milliseconds you want converted to seconds. 
 * @return Returns a numeric value. 
 * @author Pete Ruckelshaus (pruckelshaus@yahoo.com) 
 * @version 1, November 26, 2001 
 */
function MsToSec(tick) 
{
  return tick/1000;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson