From: Joseph McDonald Date: 2002-02-13T04:27:00+09:00 Subject: weird output So I have this little script to watch hits per second by tailing the access log: alog = "access_log" $stdout.sync=true lines = 0 lasttime = 0 IO.popen("tail -f #{alog}").each do |line| lines += 1 t = Time.now.to_i if t >= lasttime + +5 d = `date` d.chop! puts "#{d}\t#{t - lasttime}\t#{lines}\t#{lines/5}" lasttime = t lines = 0 end end and it works fine for 99% of the time, but every once in a while I'll get output that looks like this: Tue Feb 12 10:43:34 PST 2002 5 155 31 Tue FebTue Feb 12 10:44:13 PST 2002 5 200 40 Tue Feb 12 10:44:18 PST 2002 5 220 44 Or: Tue Feb 12 10:44:38 PST 2002 5 150 30 Tue Feb 1209 PST 2002 5 206 41 Tue Feb 12 10:44:14 PST 2002 5 204 40 See how the output of `date` is somehow munged and we are missing some time periods? Any idea how this could happen? I know, I know, I should just use Time.now() instead of `date`, but now I'm curious. thanks, -joe