TimSim: An Efficient Simulator for Wireless Ad-hoc Networks