The double threshold method realized by hardware circuits and high performance timing chip TDC-GP21 was successfully adapted to solve the key problem of ultrasonic distance measurement, the accurate time-of-flight (TOF) measurement of ultrasonic wave. Compared with other techniques of TOF measurement, the double threshold method presented in this work can suppress noise in the received signal, and achieve a time resolution of around 22 ps and real-time. This method is easy to realize and pertains the advantage of low cost. To compensate temperature and pressure deviations, a temperature measurement module of 10 mK in precision as well as a pressure measurement module of 0.01% in accuracy was developed. The system designed in this work can be exactly used as a two paths ultrasonic gas flowmeter without any adjustment of the hardware circuit. The double threshold method was further corroborated using experiment results of both the ultrasonic distance measurement and ultrasonic gas flow measurement. In distance measurement, the maximum absolute deviation and the maximum relative error are 0.69 mm and 0.28%, respectively, for a target distance range of 100-600 mm. In flow measurement, the maximum absolute deviation and the worst repeatability are 1.16% and 0.65% for a flow in the range of 50-700 m(3)/h.