--[[ Library for easy access to NTP. To use, include with `local ntp = require('shared/utils/ntp')`. ]] ---@diagnostic disable local ntp = {} ---Query NTP server. Automatically does all the things like handling KoS packets, adding 2 second delay between requests and more. ---@param hosts string|string[]|nil @Host name or IP address of a target server. If a table of several values is passed, or a string with multiple values separated by a line separator (`\n`), random host will be selected (for each sample). If not set, some generic servers will be used. ---@param samples integer? @Number of samples to make. Each sample chooses a random host from a list. If multiple samples end up using the same host, the sample with lowest delay will be used. After that, best samples from different hosts are averaged using delay for weight (but before that, outliers are discarded). If any sample ends up with an error (like a timeout), it’ll be excluded. If there are no successfull samples, last error will be returned. Default value: 1. ---@param callback fun(err: string?, epochTimeS: number?, delayS: number?) @Callback that will be called when the response is ready. If correct time couldn’t be accessed, called with `err` for error message. Otherwise, if `err` is `nil`, `epochTimeS` will store time from 1970 in seconds, and `delayS` will store summary delay of the request. function ntp.query(hosts, samples, callback) __util.native() end return ntp