nix-rust / nix

Rust friendly bindings to *nix APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for SO_TS_CLOCK sockopt for packet timestamping on FreeBSD.

recatek opened this issue · comments

As of FreeBSD 11.3, callers can control which clock is used for reporting packet receipt timestamps (in part for choosing between CLOCK_MONOTONIC and CLOCK_REALTIME). See the SO_TS_CLOCK section in man getsockopt(2). As of 0.2.146 Rust's libc added the relevant optvals for doing this (see rust-lang/libc@694e371).

I've been working on a handwritten proof of concept implementation in Rust for CLOCK_MONOTONIC here, and would be up for trying to add it back into nix if there's interest. Note that this is exclusive to FreeBSD as far as I know, no other bsd-likes support this to my knowledge.

Yeah, that sounds reasonable. It's pretty easy to add a new sockopt to Nix.