command line timeout

i'm sure i could bring the character count down a little bit with this. i needed a command i could send over ssh that would timeout if it took too long, but to end normally if it finished quickly. that's what this little series of commands does
$ ( echo haha ; sleep 3 ; kill `ps ax | awk '/sleep 17/ { if ( PROCINFO["pid"] != $1 ) print $1 }'` ) & sleep 17 && kill $!
since there are lots of sleepers around, i guess it's probably best to use a number that isn't likely to be used, like 13.4482107 might be good.