I am making a network application and I would like to display the time messages take to travel from sender to receiver.
What ways you believe are fit to implement this feature ?
What I have thought is storing the current time on message and comparing with time on receiver end. Although on java doc it says the current Time given might be different depending on OS.
How should I get the current Time so that it will be same on every OS?
(or just OSX and win)
p.s: The application in most cases is about just sending messages and not expecting something back.
The best approach is to make use of an NTP (Network Time Protocol) server to sync the time on both machines. You can also query a NTP server from your applications and get the correct time which can then be used for your calculation.