Re: Problem with frame time stamping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Antoine Zen-Ruffinen a écrit :
What does it bring me to have a nanosecond precision if it is not
related to the actual arrival of frame time ? As it seem I can feel
skb->tstamp with whatever I want, I always become something else using
ioctl(). (I'm using kernel 2.6.23).

2007/11/12, Eric Dumazet <dada1@xxxxxxxxxxxxx>:
On Mon, 12 Nov 2007 16:42:34 +0100
"Antoine Zen-Ruffinen" <antoine.zen@xxxxxxxxx> wrote:

Dear all,

I'm writing a network analyzer software using Linux and I need a VERY
precise frame time stamping. Therefor I am planing to add my own time
stamping algorithm on a modified network driver. For test purpose I
did so :

      skb->tstamp.tv64 = 0x00010002;
      netif_rx(skb);

On the user side, I ask for the timestamp that way :

      ...
      sock = socket(AF_PACKET, SOCK_RAW, type);
      ...
      //bind this socket with the interface using my modified driver.
      ...
      recvByteCount = recv(sock, buffer, 1514, 0);
      ioctl(sock, SIOCGSTAMP, &timeStamp);

I was surprised to see that the var timeStamp was still holding a
count of second since  year 1970.
But then, maybe your problem comes from your code : timeStamp should be declared as "struct timeval" of course, to get both tv_sec and tv_usec.

struct timeval tv;
ioctl(sock, SIOCSTAMP, &tv);
printf("packet arrived at %ld.%06ld\n", (long)tv.tv_sec, (long)tv.tv_usec);


If you *want* nanosecond resolution instead of microsecond, use :

struct timespec ts;
ioctl(sock, SIOCSTAMPNS, &ts);
printf("packet arrived at %ld.%09ld\n", (long)ts.tv_sec, (long)ts.tv_nsec);




-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux