當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Scalr_Util_DateTime::getIncrescentTimeInterval方法代碼示例

本文整理匯總了PHP中Scalr_Util_DateTime::getIncrescentTimeInterval方法的典型用法代碼示例。如果您正苦於以下問題:PHP Scalr_Util_DateTime::getIncrescentTimeInterval方法的具體用法?PHP Scalr_Util_DateTime::getIncrescentTimeInterval怎麽用?PHP Scalr_Util_DateTime::getIncrescentTimeInterval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Scalr_Util_DateTime的用法示例。


在下文中一共展示了Scalr_Util_DateTime::getIncrescentTimeInterval方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testIncrescentTimeInterval

 /**
  * @test
  * @dataProvider providerIncrescentTimeInterval
  */
 public function testIncrescentTimeInterval($date, $curDate, $expected)
 {
     $this->assertEquals($expected, \Scalr_Util_DateTime::getIncrescentTimeInterval($date, $curDate));
     $date = DateTime::createFromFormat('Y-m-d H:i:s', $date);
     $curDate = DateTime::createFromFormat('Y-m-d H:i:s', $curDate);
     $this->assertEquals($expected, \Scalr_Util_DateTime::getIncrescentTimeInterval($date, $curDate));
 }
開發者ID:scalr,項目名稱:scalr,代碼行數:11,代碼來源:DateTimeTest.php

示例2: getContent

 public function getContent($params = [])
 {
     if ($this->user->getType() != User::TYPE_SCALR_ADMIN) {
         throw new Scalr_Exception_InsufficientPermissions();
     }
     $hosts = [];
     foreach (ScalrHost::find() as $host) {
         $hosts[] = ['host' => $host->host, 'version' => $host->version, 'edition' => $host->edition, 'revision' => empty($host->gitCommit) ? '' : $host->gitCommit, 'revDate' => empty($host->gitCommitAdded) ? '' : $host->gitCommitAdded->format('Y-m-d H:i:s O')];
     }
     $stateNames = ScalrService::listStateNames();
     $allServices = [];
     foreach (ScalrService::find([['name' => ['$nin' => ScalrService::EXCLUDED_SERVICES]]]) as $scalrService) {
         $lastTime = empty($scalrService->lastFinish) ? time() : $scalrService->lastFinish->getTimestamp();
         $allServices[] = ['name' => ucfirst(str_replace("_", " ", $scalrService->name)), 'numWorkers' => $scalrService->numWorkers, 'numTasks' => $scalrService->numTasks, 'lastStart' => !empty($scalrService->lastStart) ? Scalr_Util_DateTime::getIncrescentTimeInterval($scalrService->lastStart) : '', 'timeSpent' => !empty($scalrService->lastStart) ? $lastTime - $scalrService->lastStart->getTimestamp() : '', 'state' => $stateNames[$scalrService->state]];
     }
     return ['hosts' => $hosts, 'services' => $allServices];
 }
開發者ID:scalr,項目名稱:scalr,代碼行數:17,代碼來源:Scalrhealth.php


注:本文中的Scalr_Util_DateTime::getIncrescentTimeInterval方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。