[Linuxptp-devel] Stepping the time backwards with phc2sys
Hello, we are syncronizing devices using ptp. The absolute time is not relevant but all devices should be close to each other. Furthermore devices are connected and disconnected at any time and most of the time there is no real grandmaster clock with higher priority. As a result, a new connected device may became ptp grandmaster and all others adjust there time. If the new grandmaster is wy back in time, phc2sys refuses to set the clock. I found the reason in the kernel and created a patch you can find attached. What do you think about that? For my understanding it would be okay to step the realtime clock backwards even below 0 because the value holding the sceonds is a signed int variable. Best regards, Matthias Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany | www.hbm.com Registered as GmbH (German limited liability corporation) in the commercial register at the local court of Darmstadt, HRB 1147 Company domiciled in Darmstadt | Managing Director: Andreas Huellhorst | Chairman of the board: Eoghan O�Lionaird Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des Amtsgerichts Darmstadt unter HRB 1147 Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | Aufsichtsratsvorsitzender: Eoghan O�Lionaird The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich fuer den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, informieren Sie mich bitte kurz und loeschen diese E-Mail. From 7de00c7bfb577964ec04ba4e25d1fe686116ff40 Mon Sep 17 00:00:00 2001 From: Matthias Loy <matthias@hbm.com> Date: Sat, 13 Jan 2018 17:14:26 +0100 Subject: [PATCH] timekeeping-allow-jump-backwards-or-with-zero-distance --- kernel/time/timekeeping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 5018482..a49eb1f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1274,9 +1274,9 @@ int timekeeping_inject_offset(struct timespec *ts) timekeeping_forward_now(tk); /* Make sure the proposed value is valid */ + /* HBM: Allow to go backward in time or setting the same value */ tmp = timespec64_add(tk_xtime(tk), ts64); - if (timespec64_compare(>wall_to_monotonic, ) > 0 || - !timespec64_valid_strict()) { + if (!timespec64_valid_strict()) { ret = -EINVAL; goto error; } -- 2.14.1 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] understanding currentUtcOffsetValid
Hi, we are not really sure about the meaning of the parameter currentUtcOffsetValid delivered by pmc GET TIME_PROPERTIES_DATA_SET. For my understanding if currentUtcOffsetValid is 0, the ptp clock uses an utc offset currentUtcOffset but is not sure whether this is the current value issued by the IERS (International Earth Rotation and Reference Systems Service). If the clock knows the current leap seconds it gives currentUtcOffsetValid = 1. And could you please acknowledge another conclusion I made in may tests with ptp: No matter whether currentUtcOffsetValid is set or not, currentUtcOffset is used in both cases to calculate utc from tai. thank you very much, Matthias Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany | www.hbm.com Registered as GmbH (German limited liability corporation) in the commercial register at the local court of Darmstadt, HRB 1147 Company domiciled in Darmstadt | Managing Director: Andreas Huellhorst | Chairman of the board: Eoghan O�Lionaird Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des Amtsgerichts Darmstadt unter HRB 1147 Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | Aufsichtsratsvorsitzender: Eoghan O�Lionaird The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich fuer den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, informieren Sie mich bitte kurz und loeschen diese E-Mail. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
[Linuxptp-devel] Wrong time structure in clock_adjtime?
Hello, I am confused about the usage of clock_settime() and clock_adjtime(). The first one gets a struct timespec which contains seconds and nanosconds. clock_adjtime takes a timex structure that contains a timeval structure which holds seconds and microseconds. When looking into the source of linuxptp, you find a clock_adjtime call in clockadj.c function clockadj_step that seems to treat timeval as containing seconds and nanoseconds. So either, the timeval is abused to contain nanoseconds or the calling function is not correct. Or am I completely wrong about that? Thanks for any help, Matthias Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany | www.hbm.com Registered as GmbH (German limited liability corporation) in the commercial register at the local court of Darmstadt, HRB 1147 Company domiciled in Darmstadt | Managing Director: Andreas Huellhorst | Chairman of the board: Eoghan O’Lionaird Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des Amtsgerichts Darmstadt unter HRB 1147 Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | Aufsichtsratsvorsitzender: Eoghan O’Lionaird The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich fuer den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, informieren Sie mich bitte kurz und loeschen diese E-Mail. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel