mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
- replace internal get_time() calls with standard PHP5 microtime(true) calls
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
20/06/2010
|
||||||
|
- replace internal get_time() calls with standard PHP5 microtime(true) calls
|
||||||
|
|
||||||
18/06/2010
|
18/06/2010
|
||||||
- added __toString method to the Smarty_Variable class
|
- added __toString method to the Smarty_Variable class
|
||||||
|
|
||||||
|
@@ -243,7 +243,7 @@ class Smarty extends Smarty_Internal_Data {
|
|||||||
if (is_callable('mb_internal_encoding')) {
|
if (is_callable('mb_internal_encoding')) {
|
||||||
mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
|
mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
|
||||||
}
|
}
|
||||||
$this->start_time = $this->_get_time();
|
$this->start_time = microtime(true);
|
||||||
// set exception handler
|
// set exception handler
|
||||||
if (!empty($this->exception_handler))
|
if (!empty($this->exception_handler))
|
||||||
set_exception_handler($this->exception_handler);
|
set_exception_handler($this->exception_handler);
|
||||||
|
@@ -374,17 +374,6 @@ class Smarty_Internal_Data {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return current time
|
|
||||||
*
|
|
||||||
* @returns double current time
|
|
||||||
*/
|
|
||||||
function _get_time()
|
|
||||||
{
|
|
||||||
$_mtime = microtime();
|
|
||||||
$_mtime = explode(" ", $_mtime);
|
|
||||||
return (double)($_mtime[1]) + (double)($_mtime[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -22,7 +22,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function start_compile($template)
|
public static function start_compile($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['start_time'] = self::get_time();
|
self::$template_data[$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +31,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function end_compile($template)
|
public static function end_compile($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['compile_time'] += self::get_time() - self::$template_data[$key]['start_time'];
|
self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +40,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function start_render($template)
|
public static function start_render($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['start_time'] = self::get_time();
|
self::$template_data[$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +49,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function end_render($template)
|
public static function end_render($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['render_time'] += self::get_time() - self::$template_data[$key]['start_time'];
|
self::$template_data[$key]['render_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,7 +58,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function start_cache($template)
|
public static function start_cache($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['start_time'] = self::get_time();
|
self::$template_data[$key]['start_time'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +67,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
public static function end_cache($template)
|
public static function end_cache($template)
|
||||||
{
|
{
|
||||||
$key = self::get_key($template);
|
$key = self::get_key($template);
|
||||||
self::$template_data[$key]['cache_time'] += self::get_time() - self::$template_data[$key]['start_time'];
|
self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Opens a window for the Smarty Debugging Consol and display the data
|
* Opens a window for the Smarty Debugging Consol and display the data
|
||||||
@@ -88,7 +88,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
$_template->assign('template_data', self::$template_data);
|
$_template->assign('template_data', self::$template_data);
|
||||||
$_template->assign('assigned_vars', $_assigned_vars);
|
$_template->assign('assigned_vars', $_assigned_vars);
|
||||||
$_template->assign('config_vars', $_config_vars);
|
$_template->assign('config_vars', $_config_vars);
|
||||||
$_template->assign('execution_time', $smarty->_get_time() - $smarty->start_time);
|
$_template->assign('execution_time', microtime(true) - $smarty->start_time);
|
||||||
echo $smarty->fetch($_template);
|
echo $smarty->fetch($_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,17 +113,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return current time
|
|
||||||
*
|
|
||||||
* @returns double current time
|
|
||||||
*/
|
|
||||||
static function get_time()
|
|
||||||
{
|
|
||||||
$_mtime = microtime();
|
|
||||||
$_mtime = explode(" ", $_mtime);
|
|
||||||
return (double)($_mtime[1]) + (double)($_mtime[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -273,15 +273,4 @@ class Smarty_Internal_Utility {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get Micro Time
|
|
||||||
*
|
|
||||||
* @return double micro time
|
|
||||||
*/
|
|
||||||
function _get_time()
|
|
||||||
{
|
|
||||||
$_mtime = microtime();
|
|
||||||
$_mtime = explode(" ", $_mtime);
|
|
||||||
return (double)($_mtime[1]) + (double)($_mtime[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user