Rx\Scheduler\EventLoopScheduler::now PHP Method

now() public method

public now ( )
    public function now()
    {
        if (function_exists('microtime')) {
            return (int) floor(microtime(true) * 1000);
        }
        return time() * 1000;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @test
  */
 public function now_returns_time_since_epoch_in_ms()
 {
     $loop = Factory::create();
     $scheduler = new EventLoopScheduler($loop);
     $this->assertTrue(abs(time() * 1000 - $scheduler->now()) < 1000, "time difference is less than or equal to 1");
 }