Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: manchek@thud.CS.UTK.EDU (Bob Manchek)
Subject: Re: Accessing Real Time Clock in workstations (HPs, Suns, Dec Alphas)
Date: 25 Jan 1994 18:42:51 GMT	[thread overview]
Message-ID: <2i3p7bINNa83@CS.UTK.EDU> (raw)
In-Reply-To: mk9krlINNna0@appserv.Eng.Sun.COM

Here's a cheezy little program from back when I was writing the
networking code.  Just compile and run...

/*
*       clockgran.c
*
*       Demonstrate the granularity of the clock by sampling it
*       as fast as we can and saving the deltas.
*
*       10 Dec 1991  Manchek
*/

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

main()
{
        struct timeval t1, t2;
        int del[200];
        int i;

        gettimeofday(&t1, (struct timezone*)0);
        for (i = 0; i < 200; i++) {
                do {
                        gettimeofday(&t2, (struct timezone*)0);
                } while (t2.tv_sec == t1.tv_sec && t2.tv_usec == t1.tv_usec);
                del[i] = (t2.tv_sec - t1.tv_sec) * 1000000 + t2.tv_usec - t1.tv_usec;
                t1 = t2;
        }
        for (i = 0; i < 200; i++) {
                printf("%8d", del[i]);
        }
        puts("");
        exit(0);
}

-- 
/ Robert Manchek                University of Tennessee     /
/                               Computer Science Department /
/ (615)974-8295                 Ayres Hall #104             /
/ manchek@CS.UTK.EDU.           Knoxville TN  37996-1301    /



  reply	other threads:[~1994-01-25 18:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-01-20 20:40 Accessing Real Time Clock in workstations (HPs, Suns, Dec Alphas) NeoSwami
1994-01-20 21:42 ` Paul Gootherts
1994-01-21 12:23   ` Kell S|nnichsen
1994-01-21 15:48   ` john.j.rushford..jr
1994-01-21 19:25     ` Guy Harris
1994-01-24 17:12   ` Benjamin Z. Goldsteen
1994-01-25  8:08     ` Bart Smaalders
1994-01-25 18:42       ` Bob Manchek [this message]
1994-01-26  0:57       ` Doug Siebert
1994-01-26  8:11         ` Casper H.S. Dik
1994-01-27  4:07         ` Greg Limes
1994-01-29  5:07       ` mark hahn
1994-01-21 16:59 ` Bart Smaalders
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox