| Crates.io | sntpc-net-std |
| lib.rs | sntpc-net-std |
| version | 1.0.1 |
| created_at | 2026-01-08 11:29:43.891782+00 |
| updated_at | 2026-01-08 13:15:55.636703+00 |
| description | std socket wrapper for sntpc library |
| homepage | |
| repository | https://github.com/vpetrigo/sntpc |
| max_upload_size | |
| id | 2030012 |
| size | 20,358 |
Standard library UDP socket adapter for the sntpc SNTP client library.
This crate provides a thin wrapper around std::net::UdpSocket that implements the NtpUdpSocket trait from sntpc.
This separation allows:
sntpc-net-std without touching core sntpcstd and sntpc coreAdd this to your Cargo.toml:
[dependencies]
sntpc = "0.8"
sntpc-net-std = "1"
use sntpc::{sync::get_time, NtpContext, StdTimestampGen};
use sntpc_net_std::UdpSocketWrapper;
use std::net::UdpSocket;
let socket = UdpSocket::bind("0.0.0.0:0").expect("Unable to create UDP socket");
let socket = UdpSocketWrapper::new(socket);
let context = NtpContext::new(StdTimestampGen::default ());
// Use with sntpc functions
For complete examples, see the sntpc examples.