diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-06-10 21:03:48 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-06-10 21:03:48 -0400 |
commit | 7891af5ec56ff4ed99435433c135079a9e24e037 (patch) | |
tree | 994abc90c1152c80dba150a3efe9859466e603b5 /test/time.awk | |
parent | 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5 (diff) | |
download | egawk-7891af5ec56ff4ed99435433c135079a9e24e037.tar.gz egawk-7891af5ec56ff4ed99435433c135079a9e24e037.tar.bz2 egawk-7891af5ec56ff4ed99435433c135079a9e24e037.zip |
Add time extension providing gettimeofday and sleep.
Diffstat (limited to 'test/time.awk')
-rw-r--r-- | test/time.awk | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/time.awk b/test/time.awk new file mode 100644 index 00000000..eeabc7bb --- /dev/null +++ b/test/time.awk @@ -0,0 +1,12 @@ +@load "time" + +BEGIN { + delta = 1.3 + printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime() + printf "sleep(%s) = %s\n",delta,sleep(delta) + printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime() + slept = t1-t0 + if ((slept < 0.9*delta) || (slept > 1.3*delta)) + printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", + delta,slept +} |