Re: [Linuxptp-devel] Wrong time structure in clock_adjtime?

2018-01-11 Thread Miroslav Lichvar
On Thu, Jan 11, 2018 at 01:03:41PM +, Loy, Matthias wrote:
> 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.

It's confusing, but it is correct. Support for nanoseconds was added
later to the interface. The timeval (and few other fields in the timex
struct) are in nanoseconds if the STA_NANO status bit is set. It's
described in the adjtimex(2) man page for instance.

-- 
Miroslav Lichvar

--
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?

2018-01-11 Thread Loy, Matthias
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