RustGLM 0.1.5

High-performance, Reliable Zhipu ChatGLM SDK natural language processing in Rust Language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use rsntp::SntpClient;
use chrono::{DateTime, Local};

pub fn time_sync() -> i64 {
    let client = SntpClient::new();
    let result = client.synchronize("ntp.aliyun.com").unwrap();

    let local_time: DateTime<Local> =
        DateTime::from(result.datetime().into_chrono_datetime().unwrap());

    let milliseconds = local_time.timestamp_millis() as i64;
    milliseconds
}