Hello community, here is the log from the commit of package php5-pear-phpunit-PHP_Timer for openSUSE:Factory checked in at 2013-08-15 12:24:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php5-pear-phpunit-PHP_Timer (Old) and /work/SRC/openSUSE:Factory/.php5-pear-phpunit-PHP_Timer.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php5-pear-phpunit-PHP_Timer" Changes: -------- --- /work/SRC/openSUSE:Factory/php5-pear-phpunit-PHP_Timer/php5-pear-phpunit-PHP_Timer.changes 2012-02-29 14:10:11.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.php5-pear-phpunit-PHP_Timer.new/php5-pear-phpunit-PHP_Timer.changes 2013-08-15 12:24:14.000000000 +0200 @@ -1,0 +2,6 @@ +Sun Aug 4 21:17:52 UTC 2013 - robert.munte...@gmail.com + +- Updated to version 1.0.5 + - No changelog from upstream + +------------------------------------------------------------------- Old: ---- PHP_Timer-1.0.2.tgz New: ---- PHP_Timer-1.0.5.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php5-pear-phpunit-PHP_Timer.spec ++++++ --- /var/tmp/diff_new_pack.qAcGeP/_old 2013-08-15 12:24:15.000000000 +0200 +++ /var/tmp/diff_new_pack.qAcGeP/_new 2013-08-15 12:24:15.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package php5-pear-phpunit-PHP_Timer # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,15 +16,14 @@ # - Name: php5-pear-phpunit-PHP_Timer %define pear_name PHP_Timer %define pear_sname php_timer Summary: Utility class for timing -Version: 1.0.2 -Release: 1 License: BSD-3-Clause Group: Development/Libraries/PHP +Version: 1.0.5 +Release: 0 Source0: http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz Url: http://pear.phpunit.de/ Requires: php5-pear-channel-phpunit @@ -36,13 +35,14 @@ BuildArch: noarch # Fix for renaming (package convention) -Provides: php5-pear-%{pear_sname} = %{version} -Provides: php-pear-%{pear_sname} = %{version} -Provides: php-pear-%{pear_name} pear-%{pear_name} +Provides: pear-%{pear_name} Provides: pear-%{pear_sname} = %{version} -Obsoletes: php5-pear-%{pear_sname} < %{version} -Obsoletes: php-pear-%{pear_sname} < %{version} +Provides: php-pear-%{pear_name} +Provides: php-pear-%{pear_sname} = %{version} +Provides: php5-pear-%{pear_sname} = %{version} Obsoletes: pear-%{pear_sname} < %{version} +Obsoletes: php-pear-%{pear_sname} < %{version} +Obsoletes: php5-pear-%{pear_sname} < %{version} %description This is a simple utility class for timing. ++++++ PHP_Timer-1.0.2.tgz -> PHP_Timer-1.0.5.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.2/ChangeLog.markdown new/PHP_Timer-1.0.2/ChangeLog.markdown --- old/PHP_Timer-1.0.2/ChangeLog.markdown 2011-09-07 13:38:14.000000000 +0200 +++ new/PHP_Timer-1.0.2/ChangeLog.markdown 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -PHP_Timer 1.0 -============= - -This is the list of changes for the PHP_Timer 1.0 release series. - -PHP_Timer 1.0.1 ---------------- - -* No changes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.2/LICENSE new/PHP_Timer-1.0.2/LICENSE --- old/PHP_Timer-1.0.2/LICENSE 2011-09-07 13:38:14.000000000 +0200 +++ new/PHP_Timer-1.0.2/LICENSE 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -PHP_Timer - -Copyright (c) 2010-2011, Sebastian Bergmann <sebast...@phpunit.de>. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Sebastian Bergmann nor the names of his - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.2/PHP/Timer/Autoload.php new/PHP_Timer-1.0.2/PHP/Timer/Autoload.php --- old/PHP_Timer-1.0.2/PHP/Timer/Autoload.php 2011-09-07 13:38:14.000000000 +0200 +++ new/PHP_Timer-1.0.2/PHP/Timer/Autoload.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -<?php -/** - * PHP_Timer - * - * Copyright (c) 2010-2011, Sebastian Bergmann <s...@sebastian-bergmann.de>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHP - * @subpackage Timer - * @author Sebastian Bergmann <s...@sebastian-bergmann.de> - * @copyright 2010-2011 Sebastian Bergmann <s...@sebastian-bergmann.de> - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @link http://github.com/sebastianbergmann/php-timer - * @since File available since Release 1.1.0 - */ - -function php_timer_autoload($class = NULL) { - static $classes = NULL; - static $path = NULL; - - if ($classes === NULL) { - $classes = array( - 'php_timer' => '/Timer.php' - ); - - $path = dirname(dirname(__FILE__)); - } - - if ($class === NULL) { - $result = array(__FILE__); - - foreach ($classes as $file) { - $result[] = $path . $file; - } - - return $result; - } - - $cn = strtolower($class); - - if (isset($classes[$cn])) { - require $path . $classes[$cn]; - } -} - -spl_autoload_register('php_timer_autoload'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.2/PHP/Timer.php new/PHP_Timer-1.0.2/PHP/Timer.php --- old/PHP_Timer-1.0.2/PHP/Timer.php 2011-09-07 13:38:14.000000000 +0200 +++ new/PHP_Timer-1.0.2/PHP/Timer.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,153 +0,0 @@ -<?php -/** - * PHP_Timer - * - * Copyright (c) 2010-2011, Sebastian Bergmann <s...@sebastian-bergmann.de>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * * Neither the name of Sebastian Bergmann nor the names of his - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package PHP - * @subpackage Timer - * @author Sebastian Bergmann <s...@sebastian-bergmann.de> - * @copyright 2010-2011 Sebastian Bergmann <s...@sebastian-bergmann.de> - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @link http://github.com/sebastianbergmann/php-timer - * @since File available since Release 1.0.0 - */ - -/** - * Utility class for timing. - * - * @package PHP - * @subpackage Timer - * @author Sebastian Bergmann <s...@sebastian-bergmann.de> - * @copyright 2010-2011 Sebastian Bergmann <s...@sebastian-bergmann.de> - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version Release: 1.0.2 - * @link http://github.com/sebastianbergmann/php-timer - * @since Class available since Release 1.0.0 - */ -class PHP_Timer -{ - /** - * @var array - */ - protected static $startTimes = array(); - - /** - * @var float - */ - public static $requestTime; - - /** - * Starts the timer. - */ - public static function start() - { - array_push(self::$startTimes, microtime(TRUE)); - } - - /** - * Stops the timer and returns the elapsed time. - * - * @return float - */ - public static function stop() - { - return microtime(TRUE) - array_pop(self::$startTimes); - } - - /** - * Formats the elapsed time as a string. - * - * @param float $time - * @return string - */ - public static function secondsToTimeString($time) - { - $buffer = ''; - - $hours = sprintf('%02d', ($time >= 3600) ? floor($time / 3600) : 0); - $minutes = sprintf( - '%02d', - ($time >= 60) ? floor($time / 60) - 60 * $hours : 0 - ); - $seconds = sprintf('%02d', $time - 60 * 60 * $hours - 60 * $minutes); - - if ($hours == 0 && $minutes == 0) { - $seconds = sprintf('%1d', $seconds); - - $buffer .= $seconds . ' second'; - - if ($seconds != '1') { - $buffer .= 's'; - } - } else { - if ($hours > 0) { - $buffer = $hours . ':'; - } - - $buffer .= $minutes . ':' . $seconds; - } - - return $buffer; - } - - /** - * Formats the elapsed time since the start of the request as a string. - * - * @return string - */ - public static function timeSinceStartOfRequest() - { - return self::secondsToTimeString(time() - self::$requestTime); - } - - /** - * Returns the resources (time, memory) of the request as a string. - * - * @return string - */ - public static function resourceUsage() - { - return sprintf( - 'Time: %s, Memory: %4.2fMb', - self::timeSinceStartOfRequest(), - memory_get_peak_usage(TRUE) / 1048576 - ); - } -} - -if (isset($_SERVER['REQUEST_TIME'])) { - PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME']; -} else { - PHP_Timer::$requestTime = time(); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.2/README.markdown new/PHP_Timer-1.0.2/README.markdown --- old/PHP_Timer-1.0.2/README.markdown 2011-09-07 13:38:14.000000000 +0200 +++ new/PHP_Timer-1.0.2/README.markdown 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -PHP_Timer -========= - -Installation ------------- - -PHP_Timer should be installed using the [PEAR Installer](http://pear.php.net/). This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0. - -The PEAR channel (`pear.phpunit.de`) that is used to distribute PHP_Timer needs to be registered with the local PEAR environment: - - sb@ubuntu ~ % pear channel-discover pear.phpunit.de - Adding Channel "pear.phpunit.de" succeeded - Discovery of channel "pear.phpunit.de" succeeded - -This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel: - - sb@vmware ~ % pear install phpunit/PHP_Timer - downloading PHP_Timer-1.0.0.tgz ... - Starting to download PHP_Timer-1.0.0.tgz (2,536 bytes) - ....done: 2,536 bytes - install ok: channel://pear.phpunit.de/PHP_Timer-1.0.0 - -After the installation you can find the PHP_Timer source files inside your local PEAR directory; the path is usually `/usr/lib/php/PHP`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.5/LICENSE new/PHP_Timer-1.0.5/LICENSE --- old/PHP_Timer-1.0.5/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/PHP_Timer-1.0.5/LICENSE 2013-08-02 09:42:08.000000000 +0200 @@ -0,0 +1,33 @@ +PHP_Timer + +Copyright (c) 2010-2013, Sebastian Bergmann <sebast...@phpunit.de>. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.5/PHP/Timer/Autoload.php new/PHP_Timer-1.0.5/PHP/Timer/Autoload.php --- old/PHP_Timer-1.0.5/PHP/Timer/Autoload.php 1970-01-01 01:00:00.000000000 +0100 +++ new/PHP_Timer-1.0.5/PHP/Timer/Autoload.php 2013-08-02 09:42:08.000000000 +0200 @@ -0,0 +1,66 @@ +<?php +/** + * PHP_Timer + * + * Copyright (c) 2010-2013, Sebastian Bergmann <sebast...@phpunit.de>. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Sebastian Bergmann nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package PHP + * @subpackage Timer + * @author Sebastian Bergmann <sebast...@phpunit.de> + * @copyright 2010-2013 Sebastian Bergmann <sebast...@phpunit.de> + * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License + * @link http://github.com/sebastianbergmann/php-timer + * @since File available since Release 1.1.0 + */ + +spl_autoload_register( + function ($class) + { + static $classes = NULL; + static $path = NULL; + + if ($classes === NULL) { + $classes = array( + 'php_timer' => '/Timer.php' + ); + + $path = dirname(dirname(__FILE__)); + } + + $cn = strtolower($class); + + if (isset($classes[$cn])) { + require $path . $classes[$cn]; + } + } +); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.5/PHP/Timer.php new/PHP_Timer-1.0.5/PHP/Timer.php --- old/PHP_Timer-1.0.5/PHP/Timer.php 1970-01-01 01:00:00.000000000 +0100 +++ new/PHP_Timer-1.0.5/PHP/Timer.php 2013-08-02 09:42:08.000000000 +0200 @@ -0,0 +1,148 @@ +<?php +/** + * PHP_Timer + * + * Copyright (c) 2010-2013, Sebastian Bergmann <sebast...@phpunit.de>. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Sebastian Bergmann nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package PHP + * @subpackage Timer + * @author Sebastian Bergmann <sebast...@phpunit.de> + * @copyright 2010-2013 Sebastian Bergmann <sebast...@phpunit.de> + * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License + * @link http://github.com/sebastianbergmann/php-timer + * @since File available since Release 1.0.0 + */ + +/** + * Utility class for timing. + * + * @package PHP + * @subpackage Timer + * @author Sebastian Bergmann <sebast...@phpunit.de> + * @copyright 2010-2013 Sebastian Bergmann <sebast...@phpunit.de> + * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License + * @version Release: 1.0.5 + * @link http://github.com/sebastianbergmann/php-timer + * @since Class available since Release 1.0.0 + */ +class PHP_Timer +{ + /** + * @var array + */ + private static $times = array( + 'hour' => 3600000, + 'minute' => 60000, + 'second' => 1000 + ); + + /** + * @var array + */ + private static $startTimes = array(); + + /** + * @var float + */ + public static $requestTime; + + /** + * Starts the timer. + */ + public static function start() + { + array_push(self::$startTimes, microtime(TRUE)); + } + + /** + * Stops the timer and returns the elapsed time. + * + * @return float + */ + public static function stop() + { + return microtime(TRUE) - array_pop(self::$startTimes); + } + + /** + * Formats the elapsed time as a string. + * + * @param float $time + * @return string + */ + public static function secondsToTimeString($time) + { + $ms = round($time * 1000); + + foreach (self::$times as $unit => $value) { + if ($ms >= $value) { + $time = floor($ms / $value * 100.0) / 100.0; + return $time . ' ' . ($time == 1 ? $unit : $unit . 's'); + } + } + + return $ms . ' ms'; + } + + /** + * Formats the elapsed time since the start of the request as a string. + * + * @return string + */ + public static function timeSinceStartOfRequest() + { + return self::secondsToTimeString(microtime(TRUE) - self::$requestTime); + } + + /** + * Returns the resources (time, memory) of the request as a string. + * + * @return string + */ + public static function resourceUsage() + { + return sprintf( + 'Time: %s, Memory: %4.2fMb', + self::timeSinceStartOfRequest(), + memory_get_peak_usage(TRUE) / 1048576 + ); + } +} + +if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { + PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT']; +} + +else { + PHP_Timer::$requestTime = microtime(TRUE); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PHP_Timer-1.0.5/README.md new/PHP_Timer-1.0.5/README.md --- old/PHP_Timer-1.0.5/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/PHP_Timer-1.0.5/README.md 2013-08-02 09:42:08.000000000 +0200 @@ -0,0 +1,56 @@ +# PHP_Timer + +Utility class for timing things, factored out of PHPUnit into a stand-alone component. + +## Installation + +You can use the [PEAR Installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php) or [Composer](http://getcomposer.org/) to download and install this package as well as its dependencies. + +### PEAR Installer + +The following two commands (which you may have to run as `root`) are all that is required to install this package using the PEAR Installer: + + pear config-set auto_discover 1 + pear install pear.phpunit.de/PHP_Timer + +### Composer + +To add this package as a local, per-project dependency to your project, simply add a dependency on `phpunit/php-timer` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on PHP_Timer: + + { + "require": { + "phpunit/php-timer": "*" + } + } + +### Usage + +#### Basic Timing + +```php +PHP_Timer::start(); + +$timer->start(); + +// ... + +$time = PHP_Timer::stop(); +var_dump($time); + +print PHP_Timer::secondsToTimeString($time); +``` + +The code above yields the output below: + + double(1.0967254638672E-5) + 0 ms + +#### Resource Consumption Since PHP Startup + +```php +print PHP_Timer::resourceUsage(); +``` + +The code above yields the output below: + + Time: 0 ms, Memory: 0.50Mb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package.sig new/package.sig --- old/package.sig 2011-09-07 13:38:25.000000000 +0200 +++ new/package.sig 2013-08-02 09:42:13.000000000 +0200 @@ -1,7 +1,7 @@ -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.10 (GNU/Linux) +Version: GnuPG v1.4.13 (GNU/Linux) -iEYEABECAAYFAk5nV7EACgkQaGfFFLhbXWl0IQCfWT/2Uw7HqTgWfa7r4WQ/7tMD -gk4AnArN3rLfZqj/UwHBGmgMPebI+Lki -=LjcT +iEYEABECAAYFAlH7YtUACgkQaGfFFLhbXWk4dwCghxAldGTjOWA9sjxH/JOEgFZ2 +IfAAniU4eEHBu2AwY2jIebQTyvr6ogBq +=+RPO -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package.xml new/package.xml --- old/package.xml 2011-09-07 13:38:14.000000000 +0200 +++ new/package.xml 2013-08-02 09:42:08.000000000 +0200 @@ -10,37 +10,36 @@ <email>s...@sebastian-bergmann.de</email> <active>yes</active> </lead> - <date>2011-09-07</date> - <time>11:38:14</time> + <date>2013-08-02</date> + <time>07:42:08</time> <version> - <release>1.0.2</release> + <release>1.0.5</release> <api>1.0.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <license>BSD License</license> + <license>The BSD 3-Clause License</license> <notes> http://github.com/sebastianbergmann/php-timer/blob/master/README.markdown </notes> <contents> <dir name="/"> - <file baseinstalldir="/" md5sum="373bbb5f3fce44d82646b25cdf58e7dd" name="PHP/Timer/Autoload.php" role="php"> + <file baseinstalldir="/" md5sum="29ee3ab408bf7b576d4a117a5feb8912" name="PHP/Timer/Autoload.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file baseinstalldir="/" md5sum="f69722829638a2d1fabdab4dd2b6c854" name="PHP/Timer.php" role="php"> + <file baseinstalldir="/" md5sum="73dbb7c1dd4fdea0a97cc59d4cfa40c7" name="PHP/Timer.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file baseinstalldir="/" md5sum="a3f8a544a1b539cee54a07e3ec7afa5d" name="ChangeLog.markdown" role="doc" /> - <file baseinstalldir="/" md5sum="ee64ef6972cbb7aff5bf2211726fd750" name="LICENSE" role="doc" /> - <file baseinstalldir="/" md5sum="5bfbe245c2c30b5f6e140f930a96e4c6" name="README.markdown" role="doc" /> + <file baseinstalldir="/" md5sum="327ee3e3abeda7c7a9605889eee50e7e" name="LICENSE" role="doc" /> + <file baseinstalldir="/" md5sum="731a603303de8707841e1c3b83501793" name="README.md" role="doc" /> </dir> </contents> <dependencies> <required> <php> - <min>5.2.7</min> + <min>5.3.3</min> </php> <pearinstaller> <min>1.9.2</min> -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org