timeinmicroseconds.c

By Hal Canary, 2007-03-22 15:50:15 (link)
#computers-code

I wrote this today as a demonstration of where /dev/random gets all its randomness.

/* Copyright 2007 Hal Canary, http://halcanary.org/
Dedicated to the Public Domain. */
#include <stdio.h>
#include <sys/time.h>
int main(void) {
        struct timeval x;
        struct timezone t;
        gettimeofday(&x, &t);
        printf("%u.%06u\n",x.tv_sec,x.tv_usec);
        return(0);
}

And then...

$ cc -o timeinmicroseconds timeinmicroseconds.c
$ while read -s -n 1 x ; do ./timeinmicroseconds ; done

(back)