[ Index ]

PHP Cross Reference of phool

title

Body

[close]

/Phool/ -> Time.php (source)

   1  <?php
   2  //=============================================================================
   3  /**
   4  * @copyright Francois Laupretre <phool@tekwire.net>
   5  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
   6  * @category phool
   7  * @package phool
   8  */
   9  //============================================================================
  10  //----------------------------------------------------------------------------
  11  
  12  namespace Phool;
  13  
  14  class Time
  15  {
  16  
  17  //---------
  18  // Converts a timestamp to a string
  19  // @ to suppress warnings about system timezone
  20  
  21  public static function timestring($time=null)
  22  {
  23  if ($time=='unlimited') return $time;
  24  if (is_null($time)) $time=time();
  25  return @strftime('%d-%b-%Y %H:%M %z',$time);
  26  }
  27  
  28  //---------
  29  
  30  public function compoundString($t='now',$tz)
  31  {
  32  $d=new \DateTime($t,new DateTimeZone($tz));
  33  return $d->format('d-M-Y H:i:s (U)');
  34  }
  35  
  36  //---------
  37  // $start=microtime() float
  38  
  39  public static function deltaMS($start)
  40  {
  41  $delta=microtime(true)-$start;
  42  
  43  return round($delta*1000,2).' ms';
  44  }
  45  
  46  //----------
  47  } // End of class
  48  //=============================================================================
  49  ?>


Generated: Thu Jun 4 19:17:11 2015 Cross-referenced by PHPXref 0.7.1