[email protected] (HE12025-10-31):
> > time sleep 3 | sleep 10
> >
> > … observe carefully the output and deduce something important about
> > time.

> that's easy
> the electrons are moving near the speed of light
> so time slows down :)

Too bad.

$ time sleep 3 | sleep 10

real    0m10.004s
user    0m0.006s
sys     0m0.001s

What you should have noticed is that time reports 10 seconds, not 3.

What it should have helped you understand is that time is not a simple
prefix command like sudo or nice, it is a special shell syntax that
operates at high priority in the parsing tree.

Once again, zsh is better:

$ time sleep 3 | sleep 10
sleep 3  0.00s user 0.00s system 0% cpu 3.002 total
sleep 10  0.00s user 0.00s system 0% cpu 10.003 total

… it reports the time of each component of the pipeline separately.

Regards,

-- 
  Nicolas George

Reply via email to