AsyncMysqlConnectResult::endTime

Description

public function endTime(): float

The end time of the connection operation, in seconds since epoch.

Return Values

  • float - the end time as float seconds since epoch.

Examples

Every connection has a connection result. You get the connection result from a call to AsyncMysqlConnection::connectResult. And one of the methods on an AsyncMysqlConnectResult is endTime(), which tells you when the connection operation completed.

Note that

  elapsedMicros() ~== endTime() - startTime()
<?hh

namespace Hack\UserDocumentation\API\Examples\AsyncMysql\ConnResult\EndTime;

use \Hack\UserDocumentation\API\Examples\AsyncMysql\ConnectionInfo as CI;

async function connect(\AsyncMysqlConnectionPool $pool):
  Awaitable<\AsyncMysqlConnection> {
  return await $pool->connect(
    CI::$host,
    CI::$port,
    CI::$db,
    CI::$user,
    CI::$passwd
  );
}
async function get_connection_start_time(): Awaitable<float> {
  $pool = new \AsyncMysqlConnectionPool(array());
  $conn = await connect($pool);
  $et = $conn->connectResult()->endTime();
  $conn->close();
  return $et;
}

function run(): void {
  $et = \HH\Asio\join(get_connection_start_time());
  var_dump($et);
}

run();
Output
float(1447364889.8539)