Crate xntp

source ·
Expand description

XNtp

xntp is a client of ntp to get net time and format

Example

use xntp::NtpClient;
fn main(){
    let client = NtpClient::new();
    let res = client.request("ntp.aliyun.com");
    println!("{}", res.unix_time);
    println!("{}", res.format_time("%Y-%m-%d %H:%M:%S"));
}
 

Structs