#!/bin/env php PHK Manager - File: /src/Phool/Time.php
Package Home

PHK Manager

PHK Home

File: /src/Phool/Time.php

Size:1123
Storage flags:

<?php
//=============================================================================
/**
* @copyright Francois Laupretre <phool@tekwire.net>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
* @category phool
* @package phool
*/
//============================================================================
//----------------------------------------------------------------------------

namespace Phool;

class 
Time
{

//---------
// Converts a timestamp to a string
// @ to suppress warnings about system timezone

public static function timestring($time=null)
{
if (
$time=='unlimited') return $time;
if (
is_null($time)) $time=time();
return @
strftime('%d-%b-%Y %H:%M %z',$time);
}

//---------

public function compoundString($t='now',$tz)
{
$d=new \DateTime($t,new DateTimeZone($tz));
return 
$d->format('d-M-Y H:i:s (U)');
}

//---------
// $start=microtime() float

public static function deltaMS($start)
{
$delta=microtime(true)-$start;

return 
round($delta*1000,2).' ms';
}

//----------
// End of class
//=============================================================================
?>

For more information about the PHK package format: http://phk.tekwire.net