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.
- May I know is there any way to synchronize the time between these two applications?
- I read about NTP, can Java use NTP to synchronize time with C# program?
- Must C# program be running as NTP Server? (Any way to do it?)
- If writing simply message exchange between these two applications, will there be any problem?
Will be greatly appreciated if anyone can provide links to study the implementations.
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.