nxs_ntp_time

The NextScripts: Social Networks Auto-Poster nxs ntp time function.

Description

nxs_ntp_time( (string) $host = 'time.nist.gov' ); 

Parameters (1)

0. $host — Optional. (string) => 'time.nist.gov'
The host.

Usage

  1. if ( !function_exists( 'nxs_ntp_time' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/inc-cl/li.php'; 
  3.  
  4. // The host. 
  5. $host = 'time.nist.gov'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = nxs_ntp_time($host); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc-cl/li.php  
  1. if (!function_exists("nxs_ntp_time")) { function nxs_ntp_time($host='time.nist.gov') { $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_connect($sock, $host, 123);  
  2. $msg = "\010" . str_repeat("\0", 47); socket_send($sock, $msg, strlen($msg), 0); socket_recv($sock, $recv, 48, MSG_WAITALL); socket_close($sock); 
  3. $data = unpack('N12', $recv); $timestamp = sprintf('%u', $data[9]); $timestamp -= 2208988800; return $timestamp; 
  4. }}