blob: 377aba459a2907fde29ee030c01104435b6a628e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
@load "time"
# make sure gettimeofday() is consistent with systime(). We must call
# gettimeofday() before systime() to make sure the subtraction gives 0
# without risk of rolling over to the next second.
function timecheck(st,res) {
res = gettimeofday()
st = systime()
printf "gettimeofday - systime = %d\n", res-st
return res
}
BEGIN {
delta = 1.3
t0 = timecheck()
printf "sleep(%s) = %s\n",delta,sleep(delta)
t1 = timecheck()
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
format = "%b %d %H:%M:%S %Y"
the_date = "Feb 11 13:12:11 1990"
then = strptime(the_date, format)
when = strftime(format, then)
print "<" the_date ">", "<<" when ">>"
}
|