summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.Timer.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
commit19985dbb8c0aa66dc4bf7905abc1148de909097d (patch)
tree2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /admin/survey/classes/class.Timer.php
download1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip
Diffstat (limited to 'admin/survey/classes/class.Timer.php')
-rw-r--r--admin/survey/classes/class.Timer.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/admin/survey/classes/class.Timer.php b/admin/survey/classes/class.Timer.php
new file mode 100644
index 0000000..f659a02
--- /dev/null
+++ b/admin/survey/classes/class.Timer.php
@@ -0,0 +1,50 @@
+<?php
+/**
+* @author Gorazd Veselič
+* @date Julij 2010
+* @desc Namenjen merjenju časa izvajanja posameznih funkcij
+*
+*/
+
+class Timer {
+
+ static private $timer = array(); # timer
+ static private $_timer_output = true; # ali timer izpiše output
+
+ static private $_decimals = 7; # Število decimalk
+ static private $_decimals_delimit = ','; # decimalno ločilo
+
+ /** Starta tajmer
+ *
+ */
+ static public function StartTimer($grups=0) {
+ # v header dodomo userid
+ $mtime = explode(" ",microtime());
+ self::$timer[$grups]['start'] = $mtime[1] + $mtime[0];
+ }
+
+ /** Vrne čas izvajanja skripte
+ *
+ */
+ static public function GetTimer($grups=0) {
+ global $lang;
+ # v header dodomo userid
+ $mtime = explode(" ",microtime());
+ self::$timer[$grups]['end'] = $mtime[1] + $mtime[0];
+ if (self::$_timer_output == true && isset(self::$timer[$grups]['start'] )) {
+ $_time = number_format((self::$timer[$grups]['end']-self::$timer[$grups]['start']), self::$_decimals , self::$_decimals_delimit, ' ');
+ printf($lang['srv_timer_output'],$grups,$_time);
+ }
+ return number_format((self::$timer[$grups]['end']-self::$timer[$grups]['start']), self::$_decimals , self::$_decimals_delimit, ' ');
+ }
+
+ /**
+ *
+ * @param unknown_type $out
+ */
+ static public function setTimerOutput($out=true) {
+ self::$_timer_output = $out;
+ return $out;
+ }
+
+}