Skip to content

Instantly share code, notes, and snippets.

@krismas
Created July 24, 2012 12:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krismas/3169775 to your computer and use it in GitHub Desktop.
Save krismas/3169775 to your computer and use it in GitHub Desktop.
A small MODX snippet to time other snippets
<?php
/*
* A small MODX snippet to time other snippets - (c) 2012 ackwa.fr
*
* @see : https://gist.github.com/gists/3169775
* @name : now.php
* @author : g.noel@ackwa.fr
* @usage : [[!now]] -> First call
* [[!now?seed=`1`]] -> subsequent calls
*
* @history : 24/06/12 - 1.0.0 - Initial revision
*/
$fNow = microtime(true);
$sSeed = ((isset($seed) && $seed ) ? $seed : 0);
$fPrev = &$_SESSION['acknow'];
$fDelay = ($sSeed ? ($fNow - $fPrev) : '');
$fPrev = $fNow;
return $fDelay;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment