def get_time ( ) : time_request = '\x1b' + 47 * '\0' now = struct . unpack ( "!12I" , ntp_service . request ( time_request , timeout = 5.0 ) . data . read ( ) ) [ 10 ] return time . ctime ( now - EPOCH_START )
python url retrieve ntp time
Get time from a locally running NTP server
def get_time():
    """Get time from a locally running NTP server"""

    time_request = '\x1b' + 47 * '\0'
    now = struct.unpack("!12I", ntp_service.request(time_request, timeout=5.0).data.read())[10]
    return time.ctime(now - EPOCH_START)