> -----Original Message-----
> From: Michael Walle [mailto:mich...@walle.cc]
> Sent: Tuesday, July 31, 2018 1:46 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH] msg: Make timestamp_{post_recv,
> pre_send}() symmetric
> 
> While the pre_send() converts the timestamp inside the packet, the
> post_recv() just copies (and converts) it into a special field inside
> the message structure. But it doesn't convert the timestamp inside the
> packet. Fix this.
> 

This seems reasonable to me.

Thanks,
Jake

> Signed-off-by: Michael Walle <mich...@walle.cc>
> ---
>  msg.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/msg.c b/msg.c
> index d1619d4..32d747a 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -238,11 +238,13 @@ static void suffix_pre_send(struct ptp_message *msg)
> 
>  static void timestamp_post_recv(struct ptp_message *m, struct Timestamp *ts)
>  {
> -     uint32_t lsb = ntohl(ts->seconds_lsb);
> -     uint16_t msb = ntohs(ts->seconds_msb);
> +     ts->seconds_lsb = ntohl(ts->seconds_lsb);
> +     ts->seconds_msb = ntohs(ts->seconds_msb);
> +     ts->nanoseconds = ntohl(ts->nanoseconds);
> 
> -     m->ts.pdu.sec  = ((uint64_t)lsb) | (((uint64_t)msb) << 32);
> -     m->ts.pdu.nsec = ntohl(ts->nanoseconds);
> +     m->ts.pdu.sec  =   (uint64_t)ts->seconds_msb << 32
> +                      | (uint64_t)ts->seconds_lsb;
> +     m->ts.pdu.nsec = ts->nanoseconds;
>  }
> 
>  static void timestamp_pre_send(struct Timestamp *ts)
> --
> 2.11.0
> 
> 
> ------------------------------------------------------------------------------
> 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

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

Reply via email to