1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Update loop time in dispatch() instead of activate()

Fixes #243.
This commit is contained in:
Aaron Piotrowski 2018-10-14 22:30:31 -05:00
parent 3fcc4d5de7
commit c4faf1f347
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -73,6 +73,8 @@ class NativeDriver extends Driver
$blocking ? $this->getTimeout() : 0 $blocking ? $this->getTimeout() : 0
); );
$this->now = (int) (\microtime(true) * self::MILLISEC_PER_SEC);
if (!empty($this->timerExpires)) { if (!empty($this->timerExpires)) {
$scheduleQueue = []; $scheduleQueue = [];
@ -265,8 +267,6 @@ class NativeDriver extends Driver
*/ */
protected function activate(array $watchers) protected function activate(array $watchers)
{ {
$now = (int) (\microtime(true) * self::MILLISEC_PER_SEC);
foreach ($watchers as $watcher) { foreach ($watchers as $watcher) {
switch ($watcher->type) { switch ($watcher->type) {
case Watcher::READABLE: case Watcher::READABLE:
@ -308,8 +308,6 @@ class NativeDriver extends Driver
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
} }
$this->now = $now;
} }
/** /**