Permalink
Browse files

added the timer plugin

  • Loading branch information...
1 parent ee76172 commit 3c7856306733284a98b9bb80234353f3a8543103 @bastianallgeier bastianallgeier committed Mar 16, 2010
Showing with 25 additions and 0 deletions.
  1. +25 −0 plugins/timer.php
View
@@ -0,0 +1,25 @@
+<?php
+
+class timer {
+
+ public static $timer = array();
+
+ function set($key='_global') {
+ if(c::get('timer') === false) return false;
+ $time = explode(' ', microtime());
+ self::$timer[$key] = (double)$time[1] + (double)$time[0];
+ }
+
+ function get($key='_global') {
+ if(c::get('timer') === false) return false;
+ $time = explode(' ', microtime());
+ $time = (double)$time[1] + (double)$time[0];
+ $timer = a::get(self::$timer, $key);
+ return round(($time-$timer), 5);
+ }
+
+}
+
+timer::set();
+
+?>

0 comments on commit 3c78563

Please sign in to comment.