I have constructed two servers in web service using java.My problem is that i couldn't figure out how can i synchronize servers time using calendar class in java.I would be glad if you help me with that, at least it would be nice to give me an example how can i do that.
Thanks
解决方案
I don't think that you should use Java to sync the system times between them. There is a matured and widely spread protocol available for this issue: The Network Time Protocol
Otherwise you have to deal with
network latency
time drifts of internal CMOS clock
getting the correct reference date
system rights: normally root is required to change the time ... and you don't want your web service running as root?
Of course, all of these issues is solved in NTP.