| Crates.io | sntpc-net-embassy |
| lib.rs | sntpc-net-embassy |
| version | 0.8.0 |
| created_at | 2026-01-08 11:29:58.496418+00 |
| updated_at | 2026-01-08 13:16:00.343478+00 |
| description | Embassy socket wrapper for sntpc library |
| homepage | |
| repository | https://github.com/vpetrigo/sntpc |
| max_upload_size | |
| id | 2030013 |
| size | 34,817 |
Embassy async runtime UDP socket adapter for the sntpc SNTP client library.
This crate provides a wrapper around embassy_net::udp::UdpSocket that implements the NtpUdpSocket trait from sntpc. This separation allows:
sntpc core updates>=0.8, <0.9)no_std embedded systemsAdd this to your Cargo.toml:
[dependencies]
sntpc = { version = "0.8", default-features = false }
sntpc-net-embassy = { version = "0.8", default-features = false }
embassy-net = { version = "0.8", features = ["udp", "proto-ipv4"] }
ipv6: Enable IPv6 protocol support (propagates to embassy-net)log: Enable logging support via the log cratedefmt: Enable logging support via the defmt crate (for embedded systems)Note: log and defmt are mutually exclusive. If both are enabled, defmt takes priority.
use sntpc::{get_time, NtpContext};
use sntpc_net_embassy::UdpSocketWrapper;
use embassy_net::udp::UdpSocket;
// Within an embassy async context
let socket = UdpSocket::new(stack, &mut rx_buffer, &mut tx_buffer);
// binding and other required steps
let socket = UdpSocketWrapper::from(socket);
let result = get_time(server_addr, &socket, ntp_context).await;
For complete examples, see the sntpc examples.