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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson