当前位置: 首页>>代码示例>>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;未经允许,请勿转载。