当前位置: 首页>>代码示例>>PHP>>正文


PHP Phing::currentTimeMillis方法代码示例

本文整理汇总了PHP中Phing::currentTimeMillis方法的典型用法代码示例。如果您正苦于以下问题:PHP Phing::currentTimeMillis方法的具体用法?PHP Phing::currentTimeMillis怎么用?PHP Phing::currentTimeMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phing的用法示例。


在下文中一共展示了Phing::currentTimeMillis方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: targetFinished

 function targetFinished(BuildEvent $event)
 {
     $msg .= PHP_EOL . "Target time: " . self::formatTime(Phing::currentTimeMillis() - $this->targetStartTime) . PHP_EOL;
     $event->setMessage($msg, Project::MSG_INFO);
     $this->messageLogged($event);
     $this->targetName = null;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:7,代码来源:TargetLogger.php

示例2: buildFinished

 /**
  * Fired when the build finishes, this adds the time taken and any
  * error stacktrace to the build element and writes the document to disk.
  *
  * @param BuildEvent $event An event with any relevant extra information.
  *                          Will not be <code>null</code>.
  * @throws BuildException
  */
 public function buildFinished(BuildEvent $event)
 {
     $elapsedTime = Phing::currentTimeMillis() - $this->getBuildTimerStart();
     $this->getBuildElement()->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
     if ($event->getException() != null) {
         $this->getBuildElement()->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage());
         $errText = $this->getDoc()->createCDATASection($event->getException()->getTraceAsString());
         $stacktrace = $this->getDoc()->createElement(XmlLogger::STACKTRACE_TAG);
         $stacktrace->appendChild($errText);
         $this->getBuildElement()->appendChild($stacktrace);
     }
     $this->getDoc()->appendChild($this->getBuildElement());
     $outFilename = $event->getProject()->getProperty("JsonLogger.file");
     if ($outFilename == null) {
         $outFilename = "log.json";
     }
     try {
         $stream = $this->getOut();
         if ($stream === null) {
             $stream = new FileOutputStream($outFilename);
         }
         $writer = new OutputStreamWriter($stream);
         $writer->write($this->xml2js(simplexml_import_dom($this->getDoc())));
         $writer->close();
     } catch (IOException $exc) {
         try {
             $stream->close();
             // in case there is a stream open still ...
         } catch (Exception $x) {
         }
         throw new BuildException("Unable to write log file.", $exc);
     }
     // cleanup:remove the buildElement
     $this->setBuildElement(null);
     array_pop($this->getElementStack());
     array_pop($this->getTimesStack());
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:45,代码来源:JsonLogger.php

示例3: buildFinished

 /**
  *  Logs whether the build succeeded or failed, and any errors that
  *  occured during the build. Also outputs the total build-time.
  *
  * @param  BuildEvent  The BuildEvent
  *
  * @see    BuildEvent::getException()
  */
 public function buildFinished(BuildEvent $event)
 {
     $error = $event->getException();
     if ($error === null) {
         $msg = "Finished successful build.";
     } else {
         $msg = "Build failed. [reason: " . $error->getMessage() . "]";
     }
     $this->logger()->log($msg . " Total time: " . DefaultLogger::formatTime(Phing::currentTimeMillis() - $this->startTime));
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:18,代码来源:PearLogListener.php

示例4: buildFinished

 /**
  *  Prints whether the build succeeded or failed, and any errors that
  *  occured during the build. Also outputs the total build-time.
  *
  *  @param  object  The BuildEvent
  *  @see    BuildEvent::getException()
  */
 public function buildFinished(BuildEvent $event)
 {
     $error = $event->getException();
     if ($error === null) {
         $msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL;
     } else {
         $msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL;
         if (Project::MSG_VERBOSE <= $this->msgOutputLevel || !$error instanceof BuildException) {
             $msg .= $error->__toString() . PHP_EOL;
         } else {
             $msg .= $error->getMessage();
         }
     }
     $msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL;
     if ($error === null) {
         $this->printMessage($msg, $this->out, Project::MSG_VERBOSE);
     } else {
         $this->printMessage($msg, $this->err, Project::MSG_ERR);
     }
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:27,代码来源:DefaultLogger.php

示例5: _touch

 /**
  * Does the actual work.
  */
 public function _touch()
 {
     if ($this->file !== null) {
         if (!$this->file->exists()) {
             $this->log("Creating " . $this->file->__toString(), Project::MSG_INFO);
             try {
                 // try to create file
                 $this->file->createNewFile();
             } catch (IOException $ioe) {
                 throw new BuildException("Error creating new file " . $this->file->__toString(), $ioe, $this->location);
             }
         }
     }
     $resetMillis = false;
     if ($this->millis < 0) {
         $resetMillis = true;
         $this->millis = Phing::currentTimeMillis();
     }
     if ($this->file !== null) {
         $this->touchFile($this->file);
     }
     // deal with the filesets
     foreach ($this->filesets as $fs) {
         $ds = $fs->getDirectoryScanner($this->getProject());
         $fromDir = $fs->getDir($this->getProject());
         $srcFiles = $ds->getIncludedFiles();
         $srcDirs = $ds->getIncludedDirectories();
         for ($j = 0, $_j = count($srcFiles); $j < $_j; $j++) {
             $this->touchFile(new PhingFile($fromDir, (string) $srcFiles[$j]));
         }
         for ($j = 0, $_j = count($srcDirs); $j < $_j; $j++) {
             $this->touchFile(new PhingFile($fromDir, (string) $srcDirs[$j]));
         }
     }
     if ($resetMillis) {
         $this->millis = -1;
     }
 }
开发者ID:tammyd,项目名称:phing,代码行数:41,代码来源:TouchTask.php

示例6: targetFinished

 /** {@inheritDoc}. */
 public function targetFinished(BuildEvent $event)
 {
     $this->log("<< TARGET FINISHED -- " . $event->getTarget()->getName(), Project::MSG_DEBUG);
     $time = $this->formatTime(Phing::currentTimeMillis() - $this->targetStartTime);
     $this->log($event->getTarget()->getName() . ":  duration " . $time, Project::MSG_VERBOSE);
     flush();
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:8,代码来源:RecorderEntry.php

示例7: taskFinished

 /**
  * Fired when a task finishes building, this adds the time taken
  * to the appropriate task element in the log.
  *
  * @param BuildEvent $event An event with any relevant extra information.
  *                          Will not be <code>null</code>.
  */
 public function taskFinished(BuildEvent $event)
 {
     $taskTimerStart = array_pop($this->timesStack);
     $taskElement = array_pop($this->elementStack);
     $elapsedTime = Phing::currentTimeMillis() - $taskTimerStart;
     $taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
     $parentElement = $this->elementStack[count($this->elementStack) - 1];
     $parentElement->appendChild($taskElement);
 }
开发者ID:codebubb,项目名称:web_ssh,代码行数:16,代码来源:XmlLogger.php

示例8: buildFinished

 /**
 *  Prints whether the build failed, and any errors that occured during 
 the build. Also outputs the total build-time on completion.
 *
 *  @param  object  The BuildEvent
 *  @access public
 *  @see    BuildEvent::getException()
 */
 function buildFinished(BuildEvent $event)
 {
     $error = $event->getException();
     if ($error !== null) {
         print $this->lSep . "BUILD FAILED" . $this->lSep;
         if (PROJECT_MSG_VERBOSE <= $this->msgOutputLevel || !$error instanceof BuildException) {
             print $error->__toString() . $this->lSep;
         } else {
             print $error->getMessage();
         }
     }
     print $this->lSep . "Total time: " . $this->_formatTime(Phing::currentTimeMillis() - $this->startTime) . $this->lSep;
 }
开发者ID:robert-h-curry,项目名称:silverstripe-buildtools,代码行数:21,代码来源:EchoLogger.php

示例9: logFinish

 private function logFinish(BuildEvent $event, $start, $name)
 {
     $msg = null;
     if ($start != null) {
         $diff = self::formatTime(Phing::currentTimeMillis() - $start);
         $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (" . $diff . ")";
     } else {
         $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (unknown duration, start not detected)";
     }
     $this->printMessage($msg, $this->out, $event->getPriority());
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:11,代码来源:ProfileLogger.php

示例10: taskFinished

 /**
  * Fired when a task finishes building, this adds the time taken
  * to the appropriate task element in the log.
  *
  * @param BuildEvent An event with any relevant extra information.
  *              Will not be <code>null</code>.
  */
 function taskFinished(BuildEvent $event)
 {
     $task = $event->getTask();
     $elapsedTime = Phing::currentTimeMillis() - $this->taskTimerStart;
     $this->taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::_formatTime($elapsedTime));
     $this->targetElement->appendChild($this->taskElement);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:14,代码来源:XmlLogger.php


注:本文中的Phing::currentTimeMillis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。