Reputation: 133
I have a Java application running on Debian OS and communicate with a Windows C# server program. My Java application will connect to C# server program via TCP/IP. A problem I am facing now is that my Debian OS system time is always slower than Windows Server System Time. Both applications are mostly run in an internal network, which has no access to Internet.
Will be greatly appreciated if anyone can provide links to study the implementations.
Upvotes: 0
Views: 501
Reputation: 175
Your network should have one centralized NTP service against which all other clocks in that network precisely synchronize themselves. Ideally, that NTP-server would synchronize itself against an Internet time-standard, but whether it does or not, it should be "the one and only source of Truth" for your entire network.
The old adage literally applies here: "a man with one watch always knows what time it is; a man with two watches never does."
It is not appropriate for your application to attempt to manage time-sync, even if somehow it possessed the necessary privileges to do so. (And it shouldn't!!) Instead, it should require that the clocks of all systems must at all times be properly synchronized against one master source. This should be its mandatory prerequisite, but not its personal responsibility.
Upvotes: 1
Reputation: 13811
The best of all worlds would be to run your own local NTP server, and then sync both boxes to your local NTP server independently. You can even run the server on one of the boxes. Then you will have a common timing baseline from which to operate.
Alternately, if you have no access or support to do this, why not send the time in the data package that is transmitted between systems. Then, you will have the information needed to understand a differential between the machines. (This does not take into account any transmission delays between boxes, but it may be good enough to get the job done.)
Upvotes: 4