diff options
author | matthieu_ <matthieu_@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2007-07-30 21:37:46 +0400 |
---|---|---|
committer | matthieu_ <matthieu_@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2007-07-30 21:37:46 +0400 |
commit | 906e61aafe9ff1ff73b16c3738dd00d6d8bfbdd2 (patch) | |
tree | 1e1929fa7c09dee753344cb61245c4f964e763e1 /modules/Timer.php | |
parent | 2157033b8b6a5aeeecad81dd0b094cbfd76a523b (diff) |
- logging system DONE
- fixed bug Access
- input filtering functions
Diffstat (limited to 'modules/Timer.php')
-rw-r--r-- | modules/Timer.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/Timer.php b/modules/Timer.php new file mode 100644 index 0000000000..5854313516 --- /dev/null +++ b/modules/Timer.php @@ -0,0 +1,32 @@ +<?php +class Piwik_Timer +{ + private $m_Start; + + public function __construct() + { + $this->m_Start = 0.0; + $this->init(); + } + + private function getMicrotime() + { + list($micro_seconds, $seconds) = explode(" ", microtime()); + return ((float)$micro_seconds + (float)$seconds); + } + + public function init() + { + $this->m_Start = $this->getMicrotime(); + } + + public function getTime($decimals = 2) + { + return number_format($this->getMicrotime() - $this->m_Start, $decimals, '.', ''); + } + public function getTimeMs($decimals = 2) + { + return number_format(1000*($this->getMicrotime() - $this->m_Start), $decimals, '.', ''); + } +} +?>
\ No newline at end of file |