Who earned a small fortune by inventing and refining an accurate timepiece that would function well on ships. this allowed accurate calculations of longitude?