Timestamp populates as if the message just took place when you login. Example: Message history is enabled in room "A".
I say "Good night!" Yesterday. I login this morning, and it shows at my login time, me saying "good night!" with the timestamp related to my login.
new behavior as of 4.0.0 (happened pre-beta as well).