lkml.org 
[lkml]   [1999]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectstrange do_gettimeofday behavior
I am experiencing rather strange behavior with the do_gettimeofday routine
on my intel based pc running 2.0.33. When I make to consecutive calls to the
do_gettimeofday function the last timestamp is smaller than the previous
taken timestamp!!

Here's a code snippet:

#define DIFF_USEC(low, hi) \
(1000000L * (hi.tv_sec - low.tv_sec) + (hi.tv_usec - low.tv_usec))

char buffer[ETH_HLEN+sizeof(short)];
struct timeval xmitStart, xmitEnd;

do_gettimeofday(&xmitStart);

memcpy(buffer, &ethHdr, ETH_HLEN);
memcpy(buffer+ETH_HLEN, &type, sizeof(short));

// this sends something over a network interface card
wrt_transmit_buffer(dev, buffer, sizeof(buffer));

do_gettimeofday(&xmitEnd);

diff = DIFF_USEC(xmitStart, xmitEnd);

How can diff be negative?
Please let me know if you have an explanation.

Thanks,

Olaf

P.S. please also e-mail me, since I'm not on the mailing list

--
Olaf Meyer | mailto://olafm@seas.upenn.edu | _~o
Computer and Information Science | http://www.seas.upenn.edu/~olafm | _-\_<,
University of Pennsylvania | | (*)/'(*)
Philadelphia, PA 19104-6389, USA | PGP: finger -l olafm@seas.upenn.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.021 / U:0.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site