Time-of-flight is the time incurred by a signal to travel from transmitter to receiver and is a highly intuitive way to measure distances using wireless signals. However, attempts at using time-of-flight for indoor localization are not accurate due to fundamental limitations in measuring time on Wi-Fi and other RF consumer technologies. Alternative methods for RF-based indoor localization do not support indoor positioning between a pair of Wi-Fi devices without third party support. The Inventors have designed a set of algorithms to overcome the above limitations and measure the time-of-flight at sub-nanosecond accuracy using off-the-shelf Wi-Fi cards. This system, called Chronos, achieves accurate device-to-device localization without any support from the infrastructure, including the location of access points.