|By Yakov Fain||
|October 21, 2012 10:24 AM EDT||
This morning I was preparing a breakfast for myself, and blogging was not in my plans. But as the saying goes, “If you want to make God laugh tell him about your plans”.
The time difference in internal clocks between the client and the remote server computer is a well known issue that software developers have to deal with in the real-time applications.
Consider traders placing orders to purchase stocks or currencies. The number of transactions per second is huge and the prices are rapidly changing. If a trader placed an order to buy 100 shares of MSFT at 10:25:33AM this doesn’t mean that the server will mark this transaction with exactly the same time. I’m not even talking about network congestions and latency issues. The issue can be caused by a simple reason – the clocks in the client and server computers are off by a second or two. Some time ago we had to send a special ping on the protocol level to calculate the difference in times.
Why do I write about it on Sunday morning when stock exchanges are closed? I was boiling eggs for breakfast. My wife always compliments me on how can I always guess the time needed to prepare soft boiled eggs. The secret is simple – just keep the eggs boiling for 5 minutes. That’s all there is to it.
When I dropped the eggs into the boiling water the microwave clock showed 9:53AM. Then I started working on my notebook, and when I checked the time again it was 9:57AM. Strange. It feels a little too soon. Time flies. But then I realized that it was my notebook clock that showed me 9:57AM, while the microwave displayed 9:55AM. The time synchronization issue in action!
The lesson learned: when you boil eggs check the time using the same clock to avoid time synchronization issues and overcooking eggs. This will make your spouse happy too. Enjoy the rest of your Sunday!