Thread: Delay Calculatin of Packet Sending Loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Code:
    Cur_Pkt_Time=tv3.tv_sec+tv3.tv_usec;
    This is incorrect. Think about what you are doing here: you are treating a microsecond the same as a second. A common way to generate integer based timestamps is to do something like this instead:
    Code:
    Cur_Pkt_Time=tv3.tv_sec*1000000ul+tv3.tv_usec;
    Now Cur_Pkt_Time is a timestamp in microseconds. Make sure that Cur_Pkt_Time is a type that can hold very large integers.
    Last edited by bithub; 12-17-2014 at 11:33 AM.
    bit∙hub [bit-huhb] n. A source and destination for information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem in sending dns packet
    By umarali89 in forum C Programming
    Replies: 1
    Last Post: 10-25-2009, 02:57 AM
  2. Packet sending
    By like_no_other in forum Networking/Device Communication
    Replies: 3
    Last Post: 03-03-2009, 10:46 AM
  3. Problem while constructing IP packet and sending using socket() system call
    By cavestine in forum Networking/Device Communication
    Replies: 10
    Last Post: 10-15-2007, 05:49 AM
  4. Networking (queuing delay, avg packet loss)
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-05-2005, 11:23 AM
  5. packet sending
    By Peaches in forum C Programming
    Replies: 2
    Last Post: 03-08-2002, 03:21 PM

Tags for this Thread