Feb-22-2021, 09:29 AM
(This post was last modified: Feb-22-2021, 09:29 AM by Serafim.
Edit Reason: Corrected my english
)
You can expect the time to be accurate if you synchronize with some atomic clock (with some time server) BUT there might be a delay of 0.02 to 0.1 second if you are unlucky. The delay depends on network activities and scheduled computer activities with high priority. Even if you use ns precision these delays can't be calculated by any means. The method that @bowlofred suggests is OK but even sleep(n) is to be considered "sleep at least for n seconds". There might be an unlucky high priority activity scheduled at that precise moment. I wouldn't expect a higher precision than 0.1 sec.