Skip to content

Instantly share code, notes, and snippets.

@rachelbythebay
rachelbythebay / gist:5074299
Created March 3, 2013 03:02
Fix timing inaccuracies stemming from initial call to time() (no microseconds) and off-by-one time reporting error stemming from incorrect placement of subsequent calls to gettimeofday().
--- script.c.stock 2013-03-02 18:37:35.000000000 -0800
+++ script.c 2013-03-02 18:38:02.000000000 -0800
@@ -312,7 +312,7 @@
time_t tvec;
char obuf[BUFSIZ];
struct timeval tv;
- double oldtime=time(NULL), newtime;
+ double oldtime, newtime;
int flgs = 0;
ssize_t wrt;