ServerStartEvent.php 505 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Events;
  3. use Hhxsv5\LaravelS\Swoole\Events\ServerStartInterface;
  4. use Swoole\Http\Server;
  5. class ServerStartEvent implements ServerStartInterface
  6. {
  7. public function __construct()
  8. {
  9. }
  10. public function handle(Server $server)
  11. {
  12. $server->startMsecTime = $this->msecTime();
  13. }
  14. private function msecTime()
  15. {
  16. list($msec, $sec) = explode(' ', microtime());
  17. $time = explode(".", $sec . ($msec * 1000));
  18. return $time[0];
  19. }
  20. }