Problem with offline messages of room

I´m having problems about how to get just the unread messages everytime that i re-enter in a room chat.

Actually i´m using the DiscussionHistory with the method setSince.

Every messages that i receive in the room i store in my local database, and, when the user re-join in this room, the app get the time of the last message and use it in that method. See the code:

Date lastMessageDate = appDB.getLastMessageFromRoom(muc.getRoom());

if (lastMessageDate != null) {

DiscussionHistory history = new DiscussionHistory();

history.setSince(new Date(lastMessageDate.getTime()));

Its working but not perfectly.

When i receive a message and i´m in the room, the message’s XML come without the timestamp (different of offline message, it comes with the timestamp).

So, in this case (message without timestamp) in my DB i am storing this messages with a current timestamp of the client machine (SQL: CODE DATETIME DEFAULT CURRENT_TIMESTAMP).

But, i can´t know if the client time is syncronized with the server time. And its causing differences.

I don´t know if I make myself clear. But i need to know if i can get the local time at the server (in my case is Open Fire) or, if i can configure my server to send the timestamp for ALL messages, not only for the offline messages.