Definition at line 35 of file Sntp.php.
◆ __construct()
__construct |
( |
|
$timeserver, |
|
|
|
$port |
|
) |
| |
Class constructor, sets the timeserver and port number
- Parameters
-
string | $timeserver | Timeserver to connect to |
integer | $port | Port of the timeserver when it differs from the default port |
Definition at line 57 of file Sntp.php.
59 $this->_timeserver =
'udp://' . $timeserver;
◆ _extract()
Extracts the data returned from the timeserver
- Parameters
-
string | $result | Data to extract |
- Returns
- integer
Definition at line 107 of file Sntp.php.
109 $dec = hexdec(
'7fffffff');
110 $time = abs(($dec - hexdec(bin2hex(
$result))) - $dec);
113 $time -= $this->_delay;
115 $this->_info[
'offset'] = $this->_delay;
◆ _prepare()
Prepares the data that will be send to the timeserver
- Returns
- array
Definition at line 70 of file Sntp.php.
◆ _read()
Reads the data returned from the timeserver
- Returns
- string
Definition at line 80 of file Sntp.php.
82 $result = fread($this->_socket, 49);
83 $this->_delay = (($this->_delay -
time()) / 2);
◆ _write()
Writes data to to the timeserver
- Parameters
-
string | $data | Data to write to the timeserver |
- Returns
- void
Definition at line 94 of file Sntp.php.
97 $this->_delay =
time();
98 fputs($this->_socket,
$data);
◆ $_port
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/TimeSync/Sntp.php