Re: GPS Leap Second Scheduled!

Chris Wedgwood (chris@cybernet.co.nz)
Thu, 10 Sep 1998 11:55:03 +1200


--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii

On Thu, Sep 10, 1998 at 11:45:15AM +1200, Chris Wedgwood wrote:

> The attached code on a PPro 200 gives me results of 2 usecs, using a
> P.II 300 and SYSENTER semantics, you can probably get this to less
> that 1usec.

Crap... here it is.

-cw

--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tv-test.c"

#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>

int main()
{
struct timeval t1,t2,t3,t4;

do{
/* warm caches */
gettimeofday(&t1,NULL);
gettimeofday(&t2,NULL);
gettimeofday(&t3,NULL);
gettimeofday(&t4,NULL);

gettimeofday(&t3,NULL);
gettimeofday(&t4,NULL);
}while(t3.tv_sec != t4.tv_sec); /* yuk */

printf("%d usecs difference!\n",(int)(t4.tv_usec - t3.tv_usec));


return 0;
}

--MGYHOYXEY6WxJCY8--

-
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/faq.html