It can hardly be pure coincidence that, before gaining a university position, the young Einstein worked in the Swiss Patent Office, dealing specifically with patents relating to the synchronisation of clocks at railway stations. It was probably there that it dawned on him: the problem of synchronising clocks was, ultimately, an insoluble one.A more in depth article on the same subject:In other words, only a few years passed between the moment at which we agreed to synchronise clocks and the moment at which Einstein realised that it was impossible to do so exactly.
Einstein was remarkably in the right place at the right time with the right idea. All of his miracle papers of 1905 treated particles as if they were real, something almost forbidden by the physics community at the time. Einstein's position as an outsider really helped.
In 1883 a compromise is reached with the idea of dividing the world into time zones, thereby standardising time only within each zone.