Hello Thomas, On Fri, 7 Jan 2022 at 16:07, Thomas Reisinger via Linuxptp-users <linuxptp-users@lists.sourceforge.net> wrote: > > Hello, > > Thats my first time here, I hope my question is right placed here. > > I am using the ptp4l/phc2sys services for my master thesis to synchronize my > clock for precise timestamping of UDP messages that I am sending in myself > programed c socket.
Do you have more details about this program? I have one too, called "isochron", and it appears to do the same thing. https://github.com/vladimiroltean/tsn-scripts > When I start the service with "sudo ptp4l -i enp3s0f2 -P -2 -s -m -q", I get > every second one of those output messages: > ptp4l[1386285.788]: master offset -4 s2 freq +56281 path delay > 289 > > It would be awesome to have access to those values: master offset -4 and the > current state "s2". > > With this information I would know, if my timestamped UDP messages are valid > (because ptp4l was in locked state with a small master offset), > or if my timestamped UDP messages are invalid (because ptp4l was in an > uncalibrated state or the offset was just to high). > > The best case would be something like: > > #include <getThoseValues.h> > > int main(){ > master_offset = getOffsetValue(); > current_state = getCurrentState(); > return 0; > } > > > I hope it was clear, what my problem is and that this functionality would be > huge benefit. Erez Geva is developing a library called "libpmc" with bindings for a few programming languages (including C++), but not C: https://sourceforge.net/projects/libpmc/ isochron, which is written in C, has its own open-coded PTP management message handling in ptpmon.c. There's also sysmon.c which monitors phc2sys offset to a given PHC. That code is GPL, so worst case, if you cannot use isochron and cannot use libpmc either, you could copy ptpmon.c and sysmon.c. Vladimir _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users