How to sync time with server?

i want show time in message history box,but local time may be is not correct,is there any way to get server time from openfire?

In case you are getting messages from the server which are already old, they usually have their “time” set.

Check that.

yes ,we can get time of legacy message, but,how to get time of a generic message.