Sort messages by id (instead of timestamp, which only has second precision).