Reputation: 742
I a have a application that uses the servers time. The local machine time may sometimes differ to the servers time. It would be very inefficient to keep on bombarding the server with get request for time. Thus the question is there a way to create my own custom clock in qt. It does not necessary have to be super accurate. a +- 2 seconds is fine.
I have tried using QDateTime along with a QTimer at that updates the QDateTime every second, but is this really the best way to do it in qt?
Upvotes: 0
Views: 90
Reputation: 259
I think a better way to solve your problem would be to request the server time and calculate the difference to your local time. You save this difference and whenever you need the server time simply add the difference to your local time.
Upvotes: 3